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:math' as math; | 5 import 'dart:math' as math; |
6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
7 import 'package:sky/app/view.dart'; | 7 import 'package:sky/app/view.dart'; |
8 import 'package:sky/rendering/box.dart'; | 8 import 'package:sky/rendering/box.dart'; |
9 import 'package:sky/rendering/block.dart'; | 9 import 'package:sky/rendering/block.dart'; |
10 | 10 |
11 AppView app; | 11 AppView app; |
12 | 12 |
13 void main() { | 13 void main() { |
14 | 14 |
15 | 15 |
16 var root = new RenderBlock(children: [ | 16 var root = new RenderBlock(children: [ |
17 new RenderPadding( | 17 new RenderPadding( |
18 padding: new EdgeDims.all(10.0), | 18 padding: new EdgeDims.all(10.0), |
19 child: new RenderSizedBox( | 19 child: new RenderConstrainedBox( |
20 desiredSize: new sky.Size.fromHeight(100.0), | 20 additionalConstraints: new BoxConstraints.tightFor(height: 100.0), |
21 child: new RenderDecoratedBox( | 21 child: new RenderDecoratedBox( |
22 decoration: new BoxDecoration( | 22 decoration: new BoxDecoration( |
23 backgroundColor: new sky.Color(0xFFFFFF00) | 23 backgroundColor: new sky.Color(0xFFFFFF00) |
24 ) | 24 ) |
25 ) | 25 ) |
26 ) | 26 ) |
27 ), | 27 ), |
28 new RenderPadding( | 28 new RenderPadding( |
29 padding: new EdgeDims.all(10.0), | 29 padding: new EdgeDims.all(10.0), |
30 child: new RenderSizedBox( | 30 child: new RenderConstrainedBox( |
31 desiredSize: new sky.Size.fromHeight(100.0), | 31 additionalConstraints: new BoxConstraints.tightFor(height: 100.0), |
32 child: new RenderDecoratedBox( | 32 child: new RenderDecoratedBox( |
33 decoration: new BoxDecoration( | 33 decoration: new BoxDecoration( |
34 border: new Border( | 34 border: new Border( |
35 top: new BorderSide(color: new sky.Color(0xFFF00000), width: 5.0), | 35 top: new BorderSide(color: new sky.Color(0xFFF00000), width: 5.0), |
36 right: new BorderSide(color: new sky.Color(0xFFFF9000), width: 10.
0), | 36 right: new BorderSide(color: new sky.Color(0xFFFF9000), width: 10.
0), |
37 bottom: new BorderSide(color: new sky.Color(0xFFFFF000), width: 15
.0), | 37 bottom: new BorderSide(color: new sky.Color(0xFFFFF000), width: 15
.0), |
38 left: new BorderSide(color: new sky.Color(0xFF00FF00), width: 20.0
) | 38 left: new BorderSide(color: new sky.Color(0xFF00FF00), width: 20.0
) |
39 ), | 39 ), |
40 backgroundColor: new sky.Color(0xFFDDDDDD) | 40 backgroundColor: new sky.Color(0xFFDDDDDD) |
41 ) | 41 ) |
42 ) | 42 ) |
43 ) | 43 ) |
44 ), | 44 ), |
45 new RenderPadding( | 45 new RenderPadding( |
46 padding: new EdgeDims.all(10.0), | 46 padding: new EdgeDims.all(10.0), |
47 child: new RenderSizedBox( | 47 child: new RenderConstrainedBox( |
48 desiredSize: new sky.Size.fromHeight(100.0), | 48 additionalConstraints: new BoxConstraints.tightFor(height: 100.0), |
49 child: new RenderDecoratedBox( | 49 child: new RenderDecoratedBox( |
50 decoration: new BoxDecoration( | 50 decoration: new BoxDecoration( |
51 backgroundColor: new sky.Color(0xFFFFFF00) | 51 backgroundColor: new sky.Color(0xFFFFFF00) |
52 ) | 52 ) |
53 ) | 53 ) |
54 ) | 54 ) |
55 ), | 55 ), |
56 new RenderPadding( | 56 new RenderPadding( |
57 padding: new EdgeDims.all(10.0), | 57 padding: new EdgeDims.all(10.0), |
58 child: new RenderSizedBox( | 58 child: new RenderConstrainedBox( |
59 desiredSize: new sky.Size.fromHeight(100.0), | 59 additionalConstraints: new BoxConstraints.tightFor(height: 100.0), |
60 child: new RenderDecoratedBox( | 60 child: new RenderDecoratedBox( |
61 decoration: new BoxDecoration( | 61 decoration: new BoxDecoration( |
62 backgroundColor: new sky.Color(0xFFFFFF00) | 62 backgroundColor: new sky.Color(0xFFFFFF00) |
63 ) | 63 ) |
64 ) | 64 ) |
65 ) | 65 ) |
66 ), | 66 ), |
67 new RenderPadding( | 67 new RenderPadding( |
68 padding: new EdgeDims.all(10.0), | 68 padding: new EdgeDims.all(10.0), |
69 child: new RenderSizedBox( | 69 child: new RenderConstrainedBox( |
70 desiredSize: new sky.Size.fromHeight(100.0), | 70 additionalConstraints: new BoxConstraints.tightFor(height: 100.0), |
71 child: new RenderDecoratedBox( | 71 child: new RenderDecoratedBox( |
72 decoration: new BoxDecoration( | 72 decoration: new BoxDecoration( |
73 backgroundColor: new sky.Color(0xFFFFFF00) | 73 backgroundColor: new sky.Color(0xFFFFFF00) |
74 ) | 74 ) |
75 ) | 75 ) |
76 ) | 76 ) |
77 ), | 77 ), |
78 ]); | 78 ]); |
79 app = new AppView(root: root); | 79 app = new AppView(root: root); |
80 } | 80 } |
OLD | NEW |