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 'package:sky/rendering/box.dart'; | 5 import 'package:sky/rendering/box.dart'; |
6 import 'package:sky/rendering/flex.dart'; | 6 import 'package:sky/rendering/flex.dart'; |
7 import 'package:sky/widgets/raised_button.dart'; | 7 import 'package:sky/widgets/raised_button.dart'; |
8 import 'package:sky/widgets/basic.dart'; | 8 import 'package:sky/widgets/basic.dart'; |
9 | 9 |
10 class ContainerApp extends App { | 10 class ContainerApp extends App { |
11 Widget build() { | 11 Widget build() { |
12 return new Flex([ | 12 return new Flex([ |
13 new Container( | 13 new Container( |
14 key: 'a', | |
15 padding: new EdgeDims.all(10.0), | 14 padding: new EdgeDims.all(10.0), |
16 margin: new EdgeDims.all(10.0), | 15 margin: new EdgeDims.all(10.0), |
17 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)
), | 16 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)
), |
18 child: new Image( | 17 child: new Image( |
19 src: "https://www.dartlang.org/logos/dart-logo.png", | 18 src: "https://www.dartlang.org/logos/dart-logo.png", |
20 size: new Size(300.0, 300.0) | 19 size: new Size(300.0, 300.0) |
21 ) | 20 ) |
22 ), | 21 ), |
23 new Container( | 22 new Container( |
24 key: 'b', | |
25 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00)
), | 23 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00)
), |
26 padding: new EdgeDims.symmetric(horizontal: 50.0, vertical: 75.0), | 24 padding: new EdgeDims.symmetric(horizontal: 50.0, vertical: 75.0), |
27 child: new Flex([ | 25 child: new Flex([ |
28 new RaisedButton( | 26 new RaisedButton( |
29 key: 'b1', | |
30 child: new Text('PRESS ME'), | 27 child: new Text('PRESS ME'), |
31 onPressed: () => print("Hello World") | 28 onPressed: () => print("Hello World") |
32 ), | 29 ), |
33 new RaisedButton( | 30 new RaisedButton( |
34 key: 'b2', | |
35 child: new Text('DISABLED'), | 31 child: new Text('DISABLED'), |
36 onPressed: () => print("Hello World"), | 32 onPressed: () => print("Hello World"), |
37 enabled: false | 33 enabled: false |
38 ) | 34 ) |
39 ]) | 35 ]) |
40 ), | 36 ), |
41 new Flexible( | 37 new Flexible( |
42 child: new Container( | 38 child: new Container( |
43 decoration: new BoxDecoration(backgroundColor: const Color(0xFF00FFF
F)) | 39 decoration: new BoxDecoration(backgroundColor: const Color(0xFF00FFF
F)) |
44 ) | 40 ) |
45 ), | 41 ), |
46 ], | 42 ], |
47 direction: FlexDirection.vertical, | 43 direction: FlexDirection.vertical, |
48 justifyContent: FlexJustifyContent.spaceBetween | 44 justifyContent: FlexJustifyContent.spaceBetween |
49 ); | 45 ); |
50 } | 46 } |
51 } | 47 } |
52 | 48 |
53 void main() { | 49 void main() { |
54 runApp(new ContainerApp()); | 50 runApp(new ContainerApp()); |
55 } | 51 } |
OLD | NEW |