OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 import 'dart:sky'; | |
6 | |
7 import 'package:sky/painting/text_style.dart'; | |
8 import 'package:sky/rendering/box.dart'; | |
9 import 'package:sky/rendering/flex.dart'; | |
10 import 'package:sky/rendering/object.dart'; | |
11 import 'package:sky/rendering/paragraph.dart'; | |
12 import 'package:sky/rendering/sky_binding.dart'; | |
13 | |
14 import '../lib/solid_color_box.dart'; | |
15 | |
16 void main() { | |
17 RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); | |
18 | |
19 RenderObject root = new RenderDecoratedBox( | |
20 decoration: new BoxDecoration(backgroundColor: const Color(0xFF606060)), | |
21 child: flexRoot | |
22 ); | |
23 | |
24 RenderObject child = new RenderSolidColorBox(const Color(0xFFFFFF00)); | |
25 flexRoot.add(child); | |
26 child.parentData.flex = 2; | |
27 | |
28 // The internet is a beautiful place. https://baconipsum.com/ | |
29 String meatyString = """Bacon ipsum dolor amet ham fatback tri-tip, prosciutto | |
30 porchetta bacon kevin meatball meatloaf pig beef ribs chicken. Brisket ribeye | |
31 andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola | |
32 alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl. | |
33 Pancetta meatball tongue tenderloin rump tail jowl boudin."""; | |
34 | |
35 var text = new InlineStyle( | |
36 new TextStyle(color: const Color(0xFF009900)), | |
37 [new InlineText(meatyString)]); | |
38 child = new RenderDecoratedBox( | |
39 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), | |
40 child: new RenderParagraph(text) | |
41 ); | |
42 flexRoot.add(child); | |
43 child.parentData.flex = 1; | |
44 | |
45 new SkyBinding(root: root); | |
46 } | |
OLD | NEW |