| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:sky/widgets/theme.dart'; | 5 import 'package:sky/widgets/theme.dart'; |
| 6 | 6 |
| 7 import '../rendering/flex.dart'; | 7 import '../rendering/flex.dart'; |
| 8 import '../theme/shadows.dart'; | 8 import '../theme/shadows.dart'; |
| 9 import '../theme/view_configuration.dart'; | 9 import '../theme/view_configuration.dart'; |
| 10 import 'basic.dart'; | 10 import 'basic.dart'; |
| 11 import 'default_text_style.dart'; |
| 11 | 12 |
| 12 class ToolBar extends Component { | 13 class ToolBar extends Component { |
| 13 | 14 |
| 14 ToolBar({ | 15 ToolBar({ |
| 15 String key, | 16 String key, |
| 16 this.left, | 17 this.left, |
| 17 this.center, | 18 this.center, |
| 18 this.right, | 19 this.right, |
| 19 this.backgroundColor | 20 this.backgroundColor |
| 20 }) : super(key: key); | 21 }) : super(key: key); |
| 21 | 22 |
| 22 final Widget left; | 23 final Widget left; |
| 23 final Widget center; | 24 final Widget center; |
| 24 final List<Widget> right; | 25 final List<Widget> right; |
| 25 final Color backgroundColor; | 26 final Color backgroundColor; |
| 26 | 27 |
| 27 Widget build() { | 28 Widget build() { |
| 28 List<Widget> children = new List<Widget>(); | 29 List<Widget> children = new List<Widget>(); |
| 29 if (left != null) | 30 if (left != null) |
| 30 children.add(left); | 31 children.add(left); |
| 31 | 32 |
| 32 if (center != null) { | 33 if (center != null) { |
| 33 children.add( | 34 children.add( |
| 34 new Flexible( | 35 new Flexible( |
| 35 child: new Padding( | 36 child: new Padding( |
| 36 child: center, | 37 child: new DefaultTextStyle( |
| 38 style: Theme.of(this).toolbarText.title, |
| 39 child: center |
| 40 ), |
| 37 padding: new EdgeDims.only(left: 24.0) | 41 padding: new EdgeDims.only(left: 24.0) |
| 38 ) | 42 ) |
| 39 ) | 43 ) |
| 40 ); | 44 ); |
| 41 } | 45 } |
| 42 | 46 |
| 43 if (right != null) | 47 if (right != null) |
| 44 children.addAll(right); | 48 children.addAll(right); |
| 45 | 49 |
| 46 return new Container( | 50 return new Container( |
| 47 child: new Flex( | 51 child: new Flex( |
| 48 [new Container(child: new Flex(children), height: kToolBarHeight)], | 52 [new Container(child: new Flex(children), height: kToolBarHeight)], |
| 49 alignItems: FlexAlignItems.flexEnd | 53 alignItems: FlexAlignItems.flexEnd |
| 50 ), | 54 ), |
| 51 padding: new EdgeDims.symmetric(horizontal: 8.0), | 55 padding: new EdgeDims.symmetric(horizontal: 8.0), |
| 52 decoration: new BoxDecoration( | 56 decoration: new BoxDecoration( |
| 53 backgroundColor: backgroundColor == null ? Theme.of(this).color[500] : b
ackgroundColor, | 57 backgroundColor: backgroundColor == null ? Theme.of(this).primary[500] :
backgroundColor, |
| 54 boxShadow: shadows[2] | 58 boxShadow: shadows[2] |
| 55 ) | 59 ) |
| 56 ); | 60 ); |
| 57 } | 61 } |
| 58 | 62 |
| 59 } | 63 } |
| OLD | NEW |