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 'dart:sky' as sky; | 5 import 'dart:sky' as sky; |
6 | 6 |
7 import 'package:sky/framework/rendering/box.dart'; | 7 import 'package:sky/framework/rendering/box.dart'; |
8 import 'package:sky/framework/rendering/flex.dart'; | 8 import 'package:sky/framework/rendering/flex.dart'; |
9 import 'package:sky/framework/scheduler.dart'; | 9 import 'package:sky/framework/scheduler.dart'; |
| 10 import 'package:sky/framework/widgets/raised_button.dart'; |
10 import 'package:sky/framework/widgets/ui_node.dart'; | 11 import 'package:sky/framework/widgets/ui_node.dart'; |
11 import 'package:sky/framework/widgets/wrappers.dart'; | 12 import 'package:sky/framework/widgets/wrappers.dart'; |
12 import 'package:vector_math/vector_math.dart'; | 13 import 'package:vector_math/vector_math.dart'; |
13 | 14 |
14 import '../lib/solid_color_box.dart'; | 15 import '../lib/solid_color_box.dart'; |
15 | 16 |
16 // Solid colour, RenderObject version | 17 // Solid colour, RenderObject version |
17 void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int
flex: 0 }) { | 18 void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int
flex: 0 }) { |
18 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); | 19 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); |
19 parent.add(child); | 20 parent.add(child); |
(...skipping 13 matching lines...) Expand all Loading... |
33 } | 34 } |
34 } | 35 } |
35 | 36 |
36 UINode builder() { | 37 UINode builder() { |
37 return new Flex([ | 38 return new Flex([ |
38 new Rectangle(const Color(0xFF00FFFF), key: 'a'), | 39 new Rectangle(const Color(0xFF00FFFF), key: 'a'), |
39 new Container( | 40 new Container( |
40 padding: new EdgeDims.all(10.0), | 41 padding: new EdgeDims.all(10.0), |
41 margin: new EdgeDims.all(10.0), | 42 margin: new EdgeDims.all(10.0), |
42 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), | 43 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), |
43 child: new Image(src: "https://www.dartlang.org/logos/dart-logo.png", | 44 child: new RaisedButton( |
44 size: new Size(300.0, 300.0), | 45 child: new Flex([ |
45 key: 1 | 46 new Image(src: "https://www.dartlang.org/logos/dart-logo.png"), |
| 47 new Text('PRESS ME'), |
| 48 ]), |
| 49 onPressed: () => print("Hello World") |
46 ) | 50 ) |
47 ), | 51 ), |
48 new Rectangle(const Color(0xFFFFFF00), key: 'b'), | 52 new Rectangle(const Color(0xFFFFFF00), key: 'b'), |
49 ], | 53 ], |
50 direction: FlexDirection.vertical, | 54 direction: FlexDirection.vertical, |
51 justifyContent: FlexJustifyContent.spaceBetween | 55 justifyContent: FlexJustifyContent.spaceBetween |
52 ); | 56 ); |
53 } | 57 } |
54 | 58 |
55 double timeBase; | 59 double timeBase; |
(...skipping 26 matching lines...) Expand all Loading... |
82 // Because we're going to use UINodes, we want to initialise its | 86 // Because we're going to use UINodes, we want to initialise its |
83 // AppView, not use the default one. We don't really need to do | 87 // AppView, not use the default one. We don't really need to do |
84 // this, because RenderObjectToUINodeAdapter does it for us, but | 88 // this, because RenderObjectToUINodeAdapter does it for us, but |
85 // it's good practice in case we happen to not have a | 89 // it's good practice in case we happen to not have a |
86 // RenderObjectToUINodeAdapter in our tree at startup. | 90 // RenderObjectToUINodeAdapter in our tree at startup. |
87 UINodeAppView.initUINodeAppView(); | 91 UINodeAppView.initUINodeAppView(); |
88 UINodeAppView.appView.root = root; | 92 UINodeAppView.appView.root = root; |
89 | 93 |
90 addPersistentFrameCallback(rotate); | 94 addPersistentFrameCallback(rotate); |
91 } | 95 } |
OLD | NEW |