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/colors.dart'; | 6 import '../theme2/colors.dart'; |
7 import '../theme/view_configuration.dart'; | 7 import '../theme2/view_configuration.dart'; |
8 | 8 |
9 class DrawerHeader extends Component { | 9 class DrawerHeader extends Component { |
10 static final Style _style = new Style(''' | |
11 height: ${140 + kStatusBarHeight}px; | |
12 background-color: ${BlueGrey[50]}; | |
13 border-bottom: 1px solid #D1D9E1; | |
14 padding-bottom: 7px; | |
15 margin-bottom: 8px;''' | |
16 ); | |
17 | |
18 static final FlexBoxParentData _spacerParentData = new FlexBoxParentData()..fl
ex = 1; | |
19 | |
20 static final Style _labelStyle = new Style(''' | |
21 padding: 0 16px;''' | |
22 ); | |
23 | 10 |
24 List<UINode> children; | 11 List<UINode> children; |
25 | 12 |
26 DrawerHeader({ Object key, this.children }) : super(key: key); | 13 DrawerHeader({ Object key, this.children }) : super(key: key); |
27 | 14 |
28 UINode build() { | 15 UINode build() { |
29 return new FlexContainer( | 16 return new Container( |
30 direction: FlexDirection.vertical, | 17 key: 'drawer-header-outside', |
31 style: _style, | 18 desiredSize: const Size.fromHeight(kStatusBarHeight + kMaterialDrawerHeigh
t), |
32 children: [ | 19 decoration: new BoxDecoration( |
33 new ParentDataNode( | 20 backgroundColor: BlueGrey[50], |
34 new Container(key: 'Spacer'), | 21 border: const Border( |
35 _spacerParentData | 22 bottom: const BorderSide( |
36 ), | 23 color: const Color(0xFFD1D9E1), |
37 new Container( | 24 width: 1.0 |
38 key: 'Label', | 25 ) |
39 style: _labelStyle, | |
40 children: children | |
41 ) | 26 ) |
42 ] | 27 ), |
| 28 padding: const EdgeDims.only(bottom: 7.0), |
| 29 margin: const EdgeDims.only(bottom: 8.0), |
| 30 child: new FlexContainer( |
| 31 key: 'drawer-header-inside', |
| 32 direction: FlexDirection.vertical, |
| 33 children: [ |
| 34 new FlexExpandingChild(new Container( |
| 35 key: 'drawer-header-spacer', |
| 36 desiredSize: Size.infinite |
| 37 )), |
| 38 new Container( |
| 39 key: 'drawer-header-label', |
| 40 padding: const EdgeDims.symmetric(horizontal: 16.0), |
| 41 child: new FlexContainer( |
| 42 direction: FlexDirection.horizontal, |
| 43 children: children |
| 44 ) |
| 45 ) |
| 46 ] |
| 47 ) |
43 ); | 48 ); |
44 } | 49 } |
45 } | 50 } |
OLD | NEW |