Corrected default tab indicator color (#15959)

This commit is contained in:
Hans Muller
2018-03-27 13:39:05 -07:00
committed by GitHub
parent eb9fc2baf9
commit 8ca99327f9
2 changed files with 12 additions and 1 deletions

View File

@@ -691,7 +691,7 @@ class _TabBarState extends State<TabBar> {
// When that happens, automatic transitions of the theme will likely look
// ugly as the indicator color suddenly snaps to white at one end, but it's
// not clear how to avoid that any further.
if (color == Material.of(context).color)
if (color.value == Material.of(context).color.value)
color = Colors.white;
return new UnderlineTabIndicator(

View File

@@ -1721,4 +1721,15 @@ void main() {
));
});
testWidgets('Default tab indicator color is white', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/15958
final List<String> tabs = <String>['LEFT', 'RIGHT'];
await tester.pumpWidget(buildLeftRightApp(tabs: tabs, value: 'LEFT'));
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
expect(tabBarBox, paints..line(
color: Colors.white,
));
});
}