Tab bar should have white indicator if primary and accent color are the same

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1215313004 .
This commit is contained in:
Collin Jackson 2015-07-07 15:35:19 -07:00
parent 589290add1
commit fe8c1e6b52
3 changed files with 13 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import 'package:sky/painting/text_style.dart';
import 'package:sky/rendering/box.dart';
import 'package:sky/rendering/object.dart';
import 'package:vector_math/vector_math.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/icon.dart';
import 'package:sky/widgets/ink_well.dart';
@ -433,11 +434,17 @@ class TabBar extends Scrollable {
textAndIcons = true;
}
Color backgroundColor = Theme.of(this).primaryColor;
Color indicatorColor = Theme.of(this).accentColor;
if (indicatorColor == backgroundColor) {
indicatorColor = colors.White;
}
TabBarWrapper tabBarWrapper = new TabBarWrapper(
children: tabs,
selectedIndex: selectedIndex,
backgroundColor: Theme.of(this).primaryColor,
indicatorColor: Theme.of(this).accentColor,
backgroundColor: backgroundColor,
indicatorColor: indicatorColor,
textAndIcons: textAndIcons,
scrollable: scrollable,
onLayoutChanged: scrollable ? _layoutChanged : null

View File

@ -27,7 +27,7 @@ PAINT FOR FRAME #2 ----------------------------------------------
2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | | | | translate(171.0, 14.0)
2 | | | | | | | | translate(-171.0, -14.0)
2 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xff9c27b0)))
2 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xffffffff)))
2 | | | | | paintChild RenderInkWell at Point(400.0, 0.0)
2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | | paintChild RenderPositionedBox at Point(412.0, 0.0)
@ -107,7 +107,7 @@ PAINT FOR FRAME #3 ----------------------------------------------
3 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
3 | | | | | | | | translate(171.0, 14.0)
3 | | | | | | | | translate(-171.0, -14.0)
3 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xff9c27b0)))
3 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xffffffff)))
3 | | | | | paintChild RenderInkWell at Point(400.0, 0.0)
3 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
3 | | | | | | paintChild RenderPositionedBox at Point(412.0, 0.0)

View File

@ -25,7 +25,7 @@ PAINT FOR FRAME #2 ----------------------------------------------
2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | | | translate(82.0, 14.0)
2 | | | | | | | translate(-82.0, -14.0)
2 | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 200.0, 48.0), Paint(color:Color(0xff2196f3)))
2 | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 200.0, 48.0), Paint(color:Color(0xffffffff)))
2 | | | | paintChild RenderInkWell at Point(200.0, 0.0)
2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | paintChild RenderPositionedBox at Point(212.0, 0.0)
@ -84,7 +84,7 @@ PAINT FOR FRAME #2 ----------------------------------------------
2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | | | | | | | translate(78.5, 14.0)
2 | | | | | | | | | | | translate(-78.5, -14.0)
2 | | | | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 188.0, 48.0), Paint(color:Color(0xff2196f3)))
2 | | | | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 188.0, 48.0), Paint(color:Color(0xffffffff)))
2 | | | | | | | | paintChild RenderInkWell at Point(188.0, 0.0)
2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0
2 | | | | | | | | | paintChild RenderPositionedBox at Point(200.0, 0.0)