mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
fix a tabs indicator padding update bug (#108287)
This commit is contained in:
parent
07de84f014
commit
4f2e32173f
@ -1024,6 +1024,7 @@ class _TabBarState extends State<TabBar> {
|
||||
} else if (widget.indicatorColor != oldWidget.indicatorColor ||
|
||||
widget.indicatorWeight != oldWidget.indicatorWeight ||
|
||||
widget.indicatorSize != oldWidget.indicatorSize ||
|
||||
widget.indicatorPadding != oldWidget.indicatorPadding ||
|
||||
widget.indicator != oldWidget.indicator) {
|
||||
_initIndicatorPainter();
|
||||
}
|
||||
|
@ -238,6 +238,35 @@ void main() {
|
||||
debugResetSemanticsIdCounter();
|
||||
});
|
||||
|
||||
testWidgets('indicatorPadding update test', (WidgetTester tester) async {
|
||||
// Regressing test for https://github.com/flutter/flutter/issues/108102
|
||||
const Tab tab = Tab(text: 'A');
|
||||
const EdgeInsets indicatorPadding = EdgeInsets.only(left: 7.0, right: 7.0);
|
||||
|
||||
await tester.pumpWidget(boilerplate(
|
||||
child: const DefaultTabController(
|
||||
length: 1,
|
||||
child: TabBar(
|
||||
tabs: <Tab>[tab],
|
||||
indicatorPadding: indicatorPadding,
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
// Change the indicatorPadding
|
||||
await tester.pumpWidget(boilerplate(
|
||||
child: DefaultTabController(
|
||||
length: 1,
|
||||
child: TabBar(
|
||||
tabs: const <Tab>[tab],
|
||||
indicatorPadding: indicatorPadding + const EdgeInsets.all(7.0),
|
||||
),
|
||||
),
|
||||
), Duration.zero, EnginePhase.build);
|
||||
|
||||
expect(tester.renderObject(find.byType(CustomPaint)).debugNeedsPaint, true);
|
||||
});
|
||||
|
||||
testWidgets('Tab sizing - icon', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0))))),
|
||||
|
Loading…
Reference in New Issue
Block a user