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 'action_bar.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 display: flex; |
| 18 flex-direction: column; |
| 19 height: -webkit-fill-available;'''); |
| 20 |
| 21 static final Style _contentStyle = new Style(''' |
| 22 flex: 1;'''); |
| 23 |
| 24 static final Style _fabStyle = new Style(''' |
| 25 position: absolute; |
| 26 bottom: 16px; |
| 27 right: 16px;'''); |
| 28 |
| 29 static final Style _drawerStyle = new Style(''' |
| 30 position: absolute; |
| 31 top: 0; |
| 32 left: 0; |
| 33 bottom: 0; |
| 34 right: 0;'''); |
| 35 |
| 36 ActionBar actionBar; |
| 37 Node content; |
| 38 FloatingActionButton fab; |
| 39 Drawer drawer; |
| 40 List<Node> overlays; |
| 41 |
| 42 Scaffold({ |
| 43 Object key, |
| 44 this.actionBar, |
| 45 this.content, |
| 46 this.fab, |
| 47 this.drawer, |
| 48 this.overlays |
| 49 }) : super(key: key); |
| 50 |
| 51 Node build() { |
| 52 var children = [ |
| 53 new Container( |
| 54 key: 'Main', |
| 55 style: _mainStyle, |
| 56 children: [ |
| 57 actionBar, |
| 58 new StyleNode(content, _contentStyle) |
| 59 ] |
| 60 ), |
| 61 ]; |
| 62 |
| 63 if (fab != null) |
| 64 children.add(new StyleNode(fab, _fabStyle)); |
| 65 |
| 66 if (drawer != null) |
| 67 children.add(new StyleNode(drawer, _drawerStyle)); |
| 68 |
| 69 if (overlays != null) |
| 70 children.addAll(overlays); |
| 71 |
| 72 return new Container(style: _style, children: children); |
| 73 } |
| 74 } |
OLD | NEW |