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