Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: sky/sdk/lib/framework/components2/tool_bar.dart

Issue 1146913005: Give the Stocks2 App a new improved toolbar. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'dart:sky' as sky;
5 import '../fn2.dart'; 6 import '../fn2.dart';
6 import '../theme/view_configuration.dart'; 7 import '../theme/view_configuration.dart';
7 import 'material.dart'; 8 import '../rendering/box.dart';
9 import '../rendering/flex.dart';
10 // import 'material.dart';
8 11
9 class ToolBar extends Component { 12 class ToolBar extends Component {
10 static final Style _style = new Style('''
11 align-items: center;
12 height: 56px;
13 padding: 0 8px;
14 transition: background-color 0.3s;
15 padding-top: ${kStatusBarHeight}px;''');
16
17 static Style _centerStyle = new Style('''
18 padding-left: 24px;''');
19
20 static FlexBoxParentData _centerLayoutSettings = new FlexBoxParentData()..flex = 1;
21
22 UINode left; 13 UINode left;
23 UINode center; 14 UINode center;
24 List<UINode> right; 15 List<UINode> right;
16 sky.Color backgroundColor;
25 17
26 ToolBar({ 18 ToolBar({
27 String key, 19 String key,
28 this.left, 20 this.left,
29 this.center, 21 this.center,
30 this.right 22 this.right,
23 this.backgroundColor
31 }) : super(key: key); 24 }) : super(key: key);
32 25
33 UINode build() { 26 UINode build() {
34 List<UINode> children = [left, new StyleNode(new ParentDataNode(center, _cen terLayoutSettings), _centerStyle)]; 27 List<UINode> children = [
28 left,
29 new FlexExpandingChild(
30 new Padding(
31 child: center,
32 padding: new EdgeDims.onlyLeft(24.0)
33 ))
34 ];
35 35
36 if (right != null) 36 if (right != null)
37 children.addAll(right); 37 children.addAll(right);
38 38
39 return new Material( 39 return new Container(
40 content: new FlexContainer( 40 child: new FlexContainer(
41 children: children, 41 children: children,
42 direction: FlexDirection.Row), 42 direction: FlexDirection.Horizontal
43 level: 2); 43 ),
44 desiredSize: new sky.Size.onlyHeight(56.0),
45 // padding: new EdgeDims(kStatusBarHeight.toDouble(), 8.0, 0.0, 8.0),
46 decoration: new BoxDecoration(backgroundColor: backgroundColor.value)
47 );
44 } 48 }
45 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698