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

Unified Diff: sky/sdk/lib/widgets/tool_bar.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/tabs.dart ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/tool_bar.dart
diff --git a/sky/sdk/lib/widgets/tool_bar.dart b/sky/sdk/lib/widgets/tool_bar.dart
index cdc251ff07f4102250aefda9f3f20a72643d1a8b..c1762169358c174b304b27cc33ca17b5dc38ca3a 100644
--- a/sky/sdk/lib/widgets/tool_bar.dart
+++ b/sky/sdk/lib/widgets/tool_bar.dart
@@ -4,11 +4,14 @@
import 'package:sky/widgets/theme.dart';
+import '../painting/text_style.dart';
import '../rendering/flex.dart';
import '../theme/shadows.dart';
+import '../theme/typography.dart' as typography;
import '../theme/view_configuration.dart';
import 'basic.dart';
import 'default_text_style.dart';
+import 'icon.dart';
class ToolBar extends Component {
@@ -26,6 +29,18 @@ class ToolBar extends Component {
final Color backgroundColor;
Widget build() {
+ Color toolbarColor = backgroundColor;
+ IconThemeColor iconThemeColor = IconThemeColor.white;
+ TextStyle defaultTextStyle = typography.white.title;
+ if (toolbarColor == null) {
+ ThemeData themeData = Theme.of(this);
+ toolbarColor = themeData.primaryColor;
+ if (themeData.primaryColorBrightness == ThemeBrightness.light) {
+ iconThemeColor = IconThemeColor.black;
+ defaultTextStyle = typography.black.title;
+ }
+ }
+
List<Widget> children = new List<Widget>();
if (left != null)
children.add(left);
@@ -35,7 +50,7 @@ class ToolBar extends Component {
new Flexible(
child: new Padding(
child: new DefaultTextStyle(
- style: Theme.of(this).toolbarText.title,
+ style: defaultTextStyle,
child: center
),
padding: new EdgeDims.only(left: 24.0)
@@ -48,13 +63,16 @@ class ToolBar extends Component {
children.addAll(right);
return new Container(
- child: new Flex(
- [new Container(child: new Flex(children), height: kToolBarHeight)],
- alignItems: FlexAlignItems.flexEnd
+ child: new IconTheme(
+ data: new IconThemeData(color: iconThemeColor),
+ child: new Flex(
+ [new Container(child: new Flex(children), height: kToolBarHeight)],
+ alignItems: FlexAlignItems.flexEnd
+ )
),
padding: new EdgeDims.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(
- backgroundColor: backgroundColor == null ? Theme.of(this).primaryColor : backgroundColor,
+ backgroundColor: toolbarColor,
boxShadow: shadows[2]
)
);
« no previous file with comments | « sky/sdk/lib/widgets/tabs.dart ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698