| 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 '../fn2.dart'; | 5 import '../fn2.dart'; |
| 6 import '../theme/view_configuration.dart'; | 6 import '../theme/view_configuration.dart'; |
| 7 import '../theme2/shadows.dart'; | 7 import '../theme2/shadows.dart'; |
| 8 | 8 |
| 9 class ToolBar extends Component { | 9 class ToolBar extends Component { |
| 10 | 10 |
| 11 ToolBar({ | 11 ToolBar({ |
| 12 String key, | 12 String key, |
| 13 this.left, | 13 this.left, |
| 14 this.center, | 14 this.center, |
| 15 this.right, | 15 this.right, |
| 16 this.backgroundColor | 16 this.backgroundColor |
| 17 }) : super(key: key); | 17 }) : super(key: key); |
| 18 | 18 |
| 19 UINode left; | 19 UINode left; |
| 20 UINode center; | 20 UINode center; |
| 21 List<UINode> right; | 21 List<UINode> right; |
| 22 Color backgroundColor; | 22 Color backgroundColor; |
| 23 | 23 |
| 24 void syncFields(ToolBar source) { |
| 25 left = source.left; |
| 26 center = source.center; |
| 27 right = source.right; |
| 28 backgroundColor = source.backgroundColor; |
| 29 super.syncFields(source); |
| 30 } |
| 31 |
| 24 UINode build() { | 32 UINode build() { |
| 25 List<UINode> children = [ | 33 List<UINode> children = [ |
| 26 left, | 34 left, |
| 27 new FlexExpandingChild( | 35 new FlexExpandingChild( |
| 28 new Padding( | 36 new Padding( |
| 29 child: center, | 37 child: center, |
| 30 padding: new EdgeDims.only(left: 24.0) | 38 padding: new EdgeDims.only(left: 24.0) |
| 31 )) | 39 )) |
| 32 ]; | 40 ]; |
| 33 | 41 |
| 34 if (right != null) | 42 if (right != null) |
| 35 children.addAll(right); | 43 children.addAll(right); |
| 36 | 44 |
| 37 return new Container( | 45 return new Container( |
| 38 child: new FlexContainer( | 46 child: new FlexContainer( |
| 39 children: children, | 47 children: children, |
| 40 direction: FlexDirection.horizontal | 48 direction: FlexDirection.horizontal |
| 41 ), | 49 ), |
| 42 height: 56.0, | 50 height: 56.0, |
| 43 padding: new EdgeDims(kStatusBarHeight.toDouble(), 8.0, 0.0, 8.0), | 51 padding: new EdgeDims(kStatusBarHeight.toDouble(), 8.0, 0.0, 8.0), |
| 44 decoration: new BoxDecoration( | 52 decoration: new BoxDecoration( |
| 45 backgroundColor: backgroundColor, | 53 backgroundColor: backgroundColor, |
| 46 boxShadow: Shadow[2] | 54 boxShadow: Shadow[2] |
| 47 ) | 55 ) |
| 48 ); | 56 ); |
| 49 } | 57 } |
| 50 | 58 |
| 51 } | 59 } |
| OLD | NEW |