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

Unified Diff: sky/examples/raw/render_paragraph.dart

Issue 1165463002: Make RenderParagraph mutable, and make it fit the new RenderNode protocols (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: git rebase -i Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/examples/raw/sector-layout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/raw/render_paragraph.dart
diff --git a/sky/examples/raw/render_paragraph.dart b/sky/examples/raw/render_paragraph.dart
index f2e444d4a8043bf64d1171b8f1319161b23fe119..6c20d91db376eef202d892060571665f200904e6 100644
--- a/sky/examples/raw/render_paragraph.dart
+++ b/sky/examples/raw/render_paragraph.dart
@@ -7,22 +7,19 @@ import 'package:sky/framework/app.dart';
import 'package:sky/framework/layout2.dart';
class RenderSolidColor extends RenderDecoratedBox {
- final double desiredHeight;
- final double desiredWidth;
+ final Size desiredSize;
final int backgroundColor;
- RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY,
- this.desiredWidth: double.INFINITY })
+ RenderSolidColor(int backgroundColor, { this.desiredSize: const Size.infinite() })
: backgroundColor = backgroundColor,
- super(new BoxDecoration(backgroundColor: backgroundColor));
+ super(decoration: new BoxDecoration(backgroundColor: backgroundColor));
Size getIntrinsicDimensions(BoxConstraints constraints) {
return constraints.constrain(new Size(desiredWidth, desiredHeight));
}
void performLayout() {
- width = constraints.constrainWidth(desiredWidth);
- height = constraints.constrainHeight(desiredHeight);
+ size = constraints.constrain(desiredSize);
}
void handlePointer(PointerEvent event) {
@@ -36,12 +33,15 @@ class RenderSolidColor extends RenderDecoratedBox {
AppView app;
void main() {
- var root = new RenderFlex(
- direction: FlexDirection.Vertical,
- decoration: new BoxDecoration(backgroundColor: 0xFF000000));
+ RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.Vertical);
+
+ RenderNode root = new RenderDecoratedBox(
+ decoration: new BoxDecoration(backgroundColor: 0xFF606060),
+ child: flexRoot
+ );
RenderNode child = new RenderSolidColor(0xFFFFFF00);
- root.add(child);
+ flexRoot.add(child);
child.parentData.flex = 2;
// The internet is a beautiful place. https://baconipsum.com/
@@ -51,8 +51,11 @@ andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola
alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl.
Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
- child = new RenderParagraph(meatyString);
- root.add(child);
+ child = new RenderDecoratedBox(
+ decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF),
+ child: new RenderParagraph(text: meatyString, color: 0xFF009900)
+ );
+ flexRoot.add(child);
child.parentData.flex = 1;
app = new AppView(root);
« no previous file with comments | « no previous file | sky/examples/raw/sector-layout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698