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

Side by Side Diff: sky/examples/raw/simple_render_tree.dart

Issue 1143153011: Refactor padding out of RenderBlock. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix hit testing 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
« no previous file with comments | « no previous file | sky/sdk/lib/framework/layout2.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'; 5 import 'dart:sky';
6 import 'package:sky/framework/app.dart'; 6 import 'package:sky/framework/app.dart';
7 import 'package:sky/framework/layout2.dart'; 7 import 'package:sky/framework/layout2.dart';
8 8
9 class RenderSolidColor extends RenderDecoratedBox { 9 class RenderSolidColor extends RenderDecoratedBox {
10 final double desiredHeight; 10 final double desiredHeight;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 child.parentData.flex = flex; 49 child.parentData.flex = flex;
50 } 50 }
51 51
52 // Yellow bar at top 52 // Yellow bar at top
53 addFlexChild(root, 0xFFFFFF00, flex: 1); 53 addFlexChild(root, 0xFFFFFF00, flex: 1);
54 54
55 // Turquoise box 55 // Turquoise box
56 root.add(new RenderSolidColor(0x7700FFFF, desiredHeight: 100.0, desiredWidth: 100.0)); 56 root.add(new RenderSolidColor(0x7700FFFF, desiredHeight: 100.0, desiredWidth: 100.0));
57 57
58 // Green and cyan render block with padding 58 // Green and cyan render block with padding
59 var renderBlock = new RenderBlock( 59 var renderBlock = new RenderBlock(decoration: new BoxDecoration(backgroundColo r: 0xFFFFFFFF));
60 decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF),
61 padding: const EdgeDims(10.0, 10.0, 10.0, 10.0));
62 60
63 renderBlock.add(new RenderSolidColor(0xFF00FF00, desiredHeight: 50.0, desiredW idth: 100.0)); 61 renderBlock.add(new RenderSolidColor(0xFF00FF00, desiredHeight: 50.0, desiredW idth: 100.0));
64 renderBlock.add(new RenderSolidColor(0x7700FFFF, desiredHeight: 100.0, desired Width: 50.0)); 62 renderBlock.add(new RenderSolidColor(0x7700FFFF, desiredHeight: 100.0, desired Width: 50.0));
65 63
66 root.add(renderBlock); 64 root.add(new RenderPadding(const EdgeDims(10.0, 10.0, 10.0, 10.0), renderBlock ));
67 65
68 var row = new RenderFlex( 66 var row = new RenderFlex(
69 direction: FlexDirection.Horizontal, 67 direction: FlexDirection.Horizontal,
70 decoration: new BoxDecoration(backgroundColor: 0xFF333333)); 68 decoration: new BoxDecoration(backgroundColor: 0xFF333333));
71 69
72 // Purple and blue cells 70 // Purple and blue cells
73 addFlexChild(row, 0x77FF00FF, flex: 1); 71 addFlexChild(row, 0x77FF00FF, flex: 1);
74 addFlexChild(row, 0xFF0000FF, flex: 2); 72 addFlexChild(row, 0xFF0000FF, flex: 2);
75 73
76 root.add(row); 74 root.add(row);
77 row.parentData.flex = 3; 75 row.parentData.flex = 3;
78 76
79 app = new AppView(root); 77 app = new AppView(root);
80 78
81 } 79 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/layout2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698