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.
This commit is contained in:
@@ -3,8 +3,12 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
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/navigator.dart';
|
||||
import 'package:sky/widgets/theme.dart';
|
||||
import 'package:sky/widgets/widget.dart';
|
||||
|
||||
import 'stock_data.dart';
|
||||
@@ -46,7 +50,10 @@ class StocksApp extends App {
|
||||
}
|
||||
|
||||
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 {
|
||||
new IconButton(
|
||||
icon: 'navigation/more_vert_white',
|
||||
onPressed: _handleMenuShow)
|
||||
],
|
||||
backgroundColor: colors.Purple[500]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
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/checkbox.dart';
|
||||
import 'package:sky/widgets/icon_button.dart';
|
||||
import 'package:sky/widgets/menu_item.dart';
|
||||
import 'package:sky/widgets/navigator.dart';
|
||||
import 'package:sky/widgets/scaffold.dart';
|
||||
import 'package:sky/widgets/theme.dart';
|
||||
import 'package:sky/widgets/tool_bar.dart';
|
||||
|
||||
class StockSettings extends Component {
|
||||
@@ -30,8 +30,7 @@ class StockSettings extends Component {
|
||||
left: new IconButton(
|
||||
icon: 'navigation/arrow_back_white',
|
||||
onPressed: _navigator.pop),
|
||||
center: new Text('Settings', style: typography.white.title),
|
||||
backgroundColor: colors.Purple[500]
|
||||
center: new Text('Settings', style: Theme.of(this).text.title)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ import 'dart:math' as math;
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.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/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/material.dart';
|
||||
import 'package:sky/widgets/raised_button.dart';
|
||||
import 'package:sky/widgets/scaffold.dart';
|
||||
import 'package:sky/widgets/theme.dart';
|
||||
import 'package:sky/widgets/tool_bar.dart';
|
||||
import 'package:sky/widgets/widget.dart';
|
||||
|
||||
@@ -74,61 +76,63 @@ class SectorApp extends App {
|
||||
}
|
||||
|
||||
Widget build() {
|
||||
return new Scaffold(
|
||||
toolbar: new ToolBar(
|
||||
center: new Text('Sector Layout in a Widget Tree', style: white.title),
|
||||
backgroundColor: Blue[500]),
|
||||
body: new Material(
|
||||
edge: MaterialEdge.canvas,
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
child: new Flex([
|
||||
new RaisedButton(
|
||||
enabled: enabledAdd,
|
||||
child: new ShrinkWrapWidth(
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectorAddIcon)
|
||||
),
|
||||
new Text('ADD SECTOR'),
|
||||
])
|
||||
return new Theme(
|
||||
data: new ThemeData(color: colors.Blue, text: typography.white),
|
||||
child: new Scaffold(
|
||||
toolbar: new ToolBar(
|
||||
center: new Text('Sector Layout in a Widget Tree', style: typography.white.title)),
|
||||
body: new Material(
|
||||
edge: MaterialEdge.canvas,
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
child: new Flex([
|
||||
new RaisedButton(
|
||||
enabled: enabledAdd,
|
||||
child: new ShrinkWrapWidth(
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectorAddIcon)
|
||||
),
|
||||
new Text('ADD SECTOR'),
|
||||
])
|
||||
),
|
||||
onPressed: addSector
|
||||
),
|
||||
onPressed: addSector
|
||||
new RaisedButton(
|
||||
enabled: enabledRemove,
|
||||
child: new ShrinkWrapWidth(
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
|
||||
),
|
||||
new Text('REMOVE SECTOR'),
|
||||
])
|
||||
),
|
||||
onPressed: removeSector
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
margin: new EdgeDims.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(new BorderSide(color: new Color(0xFF000000)))
|
||||
),
|
||||
new RaisedButton(
|
||||
enabled: enabledRemove,
|
||||
child: new ShrinkWrapWidth(
|
||||
child: new Flex([
|
||||
new Container(
|
||||
padding: new EdgeDims.all(4.0),
|
||||
margin: new EdgeDims.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
|
||||
),
|
||||
new Text('REMOVE SECTOR'),
|
||||
])
|
||||
),
|
||||
onPressed: removeSector
|
||||
)
|
||||
],
|
||||
justifyContent: FlexJustifyContent.spaceAround
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
child: new Container(
|
||||
margin: new EdgeDims.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(new BorderSide(color: new Color(0xFF000000)))
|
||||
),
|
||||
padding: new EdgeDims.all(8.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectors)
|
||||
)
|
||||
),
|
||||
],
|
||||
direction: FlexDirection.vertical,
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
padding: new EdgeDims.all(8.0),
|
||||
child: new WidgetToRenderBoxAdapter(sectors)
|
||||
)
|
||||
),
|
||||
],
|
||||
direction: FlexDirection.vertical,
|
||||
justifyContent: FlexJustifyContent.spaceBetween
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -7,10 +7,12 @@ import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
import 'package:sky/theme/colors.dart';
|
||||
import 'package:sky/theme/theme_data.dart';
|
||||
import 'package:sky/theme/typography.dart';
|
||||
import 'package:sky/widgets/basic.dart';
|
||||
import 'package:sky/widgets/material.dart';
|
||||
import 'package:sky/widgets/scaffold.dart';
|
||||
import 'package:sky/widgets/theme.dart';
|
||||
import 'package:sky/widgets/tool_bar.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.''';
|
||||
onPointerDown: toggleToTextFunction
|
||||
);
|
||||
|
||||
return new Scaffold(
|
||||
body: new Material(child: interactiveBody),
|
||||
toolbar: new ToolBar(
|
||||
center: new Text('Hal and Dave', style: white.title),
|
||||
backgroundColor: Blue[500]
|
||||
return new Theme(
|
||||
data: new ThemeData(color: Blue, text: white),
|
||||
child: new Scaffold(
|
||||
body: new Material(child: interactiveBody),
|
||||
toolbar: new ToolBar(
|
||||
center: new Text('Hal and Dave', style: white.title)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user