diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 2b387dbd3cc..41f32a504a3 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -500,7 +500,9 @@ class _DragAnimation extends Animation with AnimationWithParentMixin[ + Builder(builder: (BuildContext context) { + firstColor = DefaultTextStyle.of(context).style.color; + return const Text('First'); + }), + Builder(builder: (BuildContext context) { + secondColor = DefaultTextStyle.of(context).style.color; + return const Text('Second'); + }), + ], + ), + ), + ); + + expect(firstColor, equals(Colors.white)); + expect(secondColor, equals(Colors.black)); + + controller.offset = 0.6; + await tester.pump(); + + expect(firstColor, equals(Color.lerp(Colors.white, Colors.black, 0.6))); + expect(secondColor, equals(Color.lerp(Colors.black, Colors.white, 0.6))); + + controller.index = 1; + await tester.pump(); + + expect(firstColor, equals(Colors.black)); + expect(secondColor, equals(Colors.white)); + + controller.offset = 0.6; + await tester.pump(); + + expect(firstColor, equals(Colors.black)); + expect(secondColor, equals(Colors.white)); + }); + testWidgets('Crash on dispose', (WidgetTester tester) async { await tester.pumpWidget(Padding(padding: const EdgeInsets.only(right: 200.0), child: TabBarDemo())); await tester.tap(find.byIcon(Icons.directions_bike));