Commit 6c38fc1b authored by Collin Jackson's avatar Collin Jackson

Add a new Theme widget to control color and text color of apps

R=abarth@chromium.org, abarth, hixie

Review URL: https://codereview.chromium.org/1194743003.
parent 639e47bd
...@@ -3,8 +3,12 @@ ...@@ -3,8 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/rendering/sky_binding.dart'; import 'package:sky/rendering/sky_binding.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/theme_data.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/widgets/basic.dart'; import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/navigator.dart'; import 'package:sky/widgets/navigator.dart';
import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/widget.dart'; import 'package:sky/widgets/widget.dart';
import 'stock_data.dart'; import 'stock_data.dart';
...@@ -46,7 +50,10 @@ class StocksApp extends App { ...@@ -46,7 +50,10 @@ class StocksApp extends App {
} }
Widget build() { Widget build() {
return new Navigator(_navigationState); return new Theme(
data: new ThemeData(color: colors.Purple, text: typography.white),
child: new Navigator(_navigationState)
);
} }
} }
......
...@@ -169,8 +169,7 @@ class StockHome extends Component { ...@@ -169,8 +169,7 @@ class StockHome extends Component {
new IconButton( new IconButton(
icon: 'navigation/more_vert_white', icon: 'navigation/more_vert_white',
onPressed: _handleMenuShow) onPressed: _handleMenuShow)
], ]
backgroundColor: colors.Purple[500]
); );
} }
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/theme/colors.dart' as colors; 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/basic.dart';
import 'package:sky/widgets/checkbox.dart'; import 'package:sky/widgets/checkbox.dart';
import 'package:sky/widgets/icon_button.dart'; import 'package:sky/widgets/icon_button.dart';
import 'package:sky/widgets/menu_item.dart'; import 'package:sky/widgets/menu_item.dart';
import 'package:sky/widgets/navigator.dart'; import 'package:sky/widgets/navigator.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/tool_bar.dart';
class StockSettings extends Component { class StockSettings extends Component {
...@@ -30,8 +30,7 @@ class StockSettings extends Component { ...@@ -30,8 +30,7 @@ class StockSettings extends Component {
left: new IconButton( left: new IconButton(
icon: 'navigation/arrow_back_white', icon: 'navigation/arrow_back_white',
onPressed: _navigator.pop), onPressed: _navigator.pop),
center: new Text('Settings', style: typography.white.title), center: new Text('Settings', style: Theme.of(this).text.title)
backgroundColor: colors.Purple[500]
); );
} }
......
...@@ -7,13 +7,15 @@ import 'dart:math' as math; ...@@ -7,13 +7,15 @@ import 'dart:math' as math;
import 'package:sky/rendering/box.dart'; import 'package:sky/rendering/box.dart';
import 'package:sky/rendering/flex.dart'; import 'package:sky/rendering/flex.dart';
import 'package:sky/rendering/sky_binding.dart'; import 'package:sky/rendering/sky_binding.dart';
import 'package:sky/theme/colors.dart'; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/edges.dart'; import 'package:sky/theme/edges.dart';
import 'package:sky/theme/typography.dart'; import 'package:sky/theme/theme_data.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/widgets/basic.dart'; import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/material.dart'; import 'package:sky/widgets/material.dart';
import 'package:sky/widgets/raised_button.dart'; import 'package:sky/widgets/raised_button.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/tool_bar.dart';
import 'package:sky/widgets/widget.dart'; import 'package:sky/widgets/widget.dart';
...@@ -74,10 +76,11 @@ class SectorApp extends App { ...@@ -74,10 +76,11 @@ class SectorApp extends App {
} }
Widget build() { Widget build() {
return new Scaffold( return new Theme(
data: new ThemeData(color: colors.Blue, text: typography.white),
child: new Scaffold(
toolbar: new ToolBar( toolbar: new ToolBar(
center: new Text('Sector Layout in a Widget Tree', style: white.title), center: new Text('Sector Layout in a Widget Tree', style: typography.white.title)),
backgroundColor: Blue[500]),
body: new Material( body: new Material(
edge: MaterialEdge.canvas, edge: MaterialEdge.canvas,
child: new Flex([ child: new Flex([
...@@ -131,6 +134,7 @@ class SectorApp extends App { ...@@ -131,6 +134,7 @@ class SectorApp extends App {
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
) )
) )
)
); );
} }
} }
......
...@@ -7,10 +7,12 @@ import 'package:sky/rendering/box.dart'; ...@@ -7,10 +7,12 @@ import 'package:sky/rendering/box.dart';
import 'package:sky/rendering/flex.dart'; import 'package:sky/rendering/flex.dart';
import 'package:sky/rendering/sky_binding.dart'; import 'package:sky/rendering/sky_binding.dart';
import 'package:sky/theme/colors.dart'; import 'package:sky/theme/colors.dart';
import 'package:sky/theme/theme_data.dart';
import 'package:sky/theme/typography.dart'; import 'package:sky/theme/typography.dart';
import 'package:sky/widgets/basic.dart'; import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/material.dart'; import 'package:sky/widgets/material.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/tool_bar.dart';
import 'package:sky/widgets/widget.dart'; import 'package:sky/widgets/widget.dart';
...@@ -105,11 +107,13 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -105,11 +107,13 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
onPointerDown: toggleToTextFunction onPointerDown: toggleToTextFunction
); );
return new Scaffold( return new Theme(
data: new ThemeData(color: Blue, text: white),
child: new Scaffold(
body: new Material(child: interactiveBody), body: new Material(child: interactiveBody),
toolbar: new ToolBar( toolbar: new ToolBar(
center: new Text('Hal and Dave', style: white.title), center: new Text('Hal and Dave', style: white.title)
backgroundColor: Blue[500] )
) )
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment