OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 import '../fn.dart'; | |
6 import '../layout.dart'; | |
7 import 'drawer.dart'; | |
8 import 'floating_action_button.dart'; | |
9 import 'package:sky/framework/theme/typography.dart' as typography; | |
10 | |
11 class Scaffold extends Component { | |
12 static final Style _style = new Style(''' | |
13 ${typography.typeface}; | |
14 ${typography.black.body1};'''); | |
15 | |
16 static final Style _mainStyle = new Style(''' | |
17 height: -webkit-fill-available;'''); | |
18 | |
19 static final FlexBoxParentData _contentParentData = new FlexBoxParentData()..f
lex = 1; | |
20 | |
21 static final Style _fabStyle = new Style(''' | |
22 position: absolute; | |
23 bottom: 16px; | |
24 right: 16px;'''); | |
25 | |
26 static final Style _drawerStyle = new Style(''' | |
27 position: absolute; | |
28 top: 0; | |
29 left: 0; | |
30 bottom: 0; | |
31 right: 0;'''); | |
32 | |
33 UINode header; | |
34 UINode content; | |
35 FloatingActionButton fab; | |
36 Drawer drawer; | |
37 List<UINode> overlays; | |
38 | |
39 Scaffold({ | |
40 Object key, | |
41 this.header, | |
42 this.content, | |
43 this.fab, | |
44 this.drawer, | |
45 this.overlays | |
46 }) : super(key: key); | |
47 | |
48 UINode build() { | |
49 List<UINode> children = [ | |
50 new FlexContainer( | |
51 key: 'Main', | |
52 direction: FlexDirection.Column, | |
53 style: _mainStyle, | |
54 children: [header, new ParentDataNode(content, _contentParentData)]) | |
55 ]; | |
56 | |
57 if (fab != null) | |
58 children.add(new StyleNode(fab, _fabStyle)); | |
59 | |
60 if (drawer != null) | |
61 children.add(new StyleNode(drawer, _drawerStyle)); | |
62 | |
63 if (overlays != null) | |
64 children.addAll(overlays); | |
65 | |
66 return new Container(style: _style, children: children); | |
67 } | |
68 } | |
OLD | NEW |