Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: sky/sdk/lib/widgets/tabs.dart

Issue 1235443002: Support for icon theming (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix analyzer warning Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/widgets/menu_item.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/tabs.dart
diff --git a/sky/sdk/lib/widgets/tabs.dart b/sky/sdk/lib/widgets/tabs.dart
index f171edf852385275d9372c5423083c980e559063..89917b594e96abbcd213e670ef1320b06254f65c 100644
--- a/sky/sdk/lib/widgets/tabs.dart
+++ b/sky/sdk/lib/widgets/tabs.dart
@@ -12,7 +12,9 @@ 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/theme/typography.dart' as typography;
import 'package:sky/widgets/basic.dart';
+import 'package:sky/widgets/default_text_style.dart';
import 'package:sky/widgets/icon.dart';
import 'package:sky/widgets/ink_well.dart';
import 'package:sky/widgets/scrollable.dart';
@@ -301,8 +303,7 @@ class Tab extends Component {
Widget _buildLabelText() {
assert(label.text != null);
- TextStyle textStyle = Theme.of(this).toolbarText.button.merge(_kTabTextStyle);
- return new Text(label.text, style: textStyle);
+ return new Text(label.text, style: _kTabTextStyle);
}
Widget _buildLabelIcon() {
@@ -434,25 +435,47 @@ class TabBar extends Scrollable {
textAndIcons = true;
}
- Color backgroundColor = Theme.of(this).primaryColor;
- Color indicatorColor = Theme.of(this).accentColor;
+ ThemeData themeData = Theme.of(this);
+ Color backgroundColor = themeData.primaryColor;
+ Color indicatorColor = themeData.accentColor;
if (indicatorColor == backgroundColor) {
indicatorColor = colors.White;
}
- TabBarWrapper tabBarWrapper = new TabBarWrapper(
- children: tabs,
- selectedIndex: selectedIndex,
- backgroundColor: backgroundColor,
- indicatorColor: indicatorColor,
- textAndIcons: textAndIcons,
- scrollable: scrollable,
- onLayoutChanged: scrollable ? _layoutChanged : null
- );
+ TextStyle textStyle;
+ IconThemeColor iconThemeColor;
+ switch (themeData.primaryColorBrightness) {
+ case ThemeBrightness.light:
+ textStyle = typography.black.body1;
+ iconThemeColor = IconThemeColor.black;
+ break;
+ case ThemeBrightness.dark:
+ textStyle = typography.white.body1;
+ iconThemeColor = IconThemeColor.white;
+ break;
+ }
Matrix4 transform = new Matrix4.identity();
transform.translate(-scrollOffset, 0.0);
- return new Transform(child: tabBarWrapper, transform: transform);
+
+ return new Transform(
+ transform: transform,
+ child: new IconTheme(
+ data: new IconThemeData(color: iconThemeColor),
+ child: new DefaultTextStyle(
+ style: textStyle,
+ child: new TabBarWrapper(
+ children: tabs,
+ selectedIndex: selectedIndex,
+ backgroundColor: backgroundColor,
+ indicatorColor: indicatorColor,
+ textAndIcons: textAndIcons,
+ scrollable: scrollable,
+ onLayoutChanged: scrollable ? _layoutChanged : null
+ )
+ )
+ )
+ );
}
}
« no previous file with comments | « sky/sdk/lib/widgets/menu_item.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698