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

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

Issue 1150253005: Replace BoxDimensions with sky.Size (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/examples/raw/sector-layout.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;
11 final double desiredWidth; 11 final double desiredWidth;
12 final int backgroundColor; 12 final int backgroundColor;
13 13
14 RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY, 14 RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY,
15 this.desiredWidth: double.INFINITY }) 15 this.desiredWidth: double.INFINITY })
16 : backgroundColor = backgroundColor, 16 : backgroundColor = backgroundColor,
17 super(new BoxDecoration(backgroundColor: backgroundColor)); 17 super(new BoxDecoration(backgroundColor: backgroundColor));
18 18
19 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { 19 Size getIntrinsicDimensions(BoxConstraints constraints) {
20 return new BoxDimensions.withConstraints(constraints, 20 return constraints.constrain(new Size(desiredWidth, desiredHeight));
21 height: desiredHeight,
22 width: desiredWidth);
23 } 21 }
24 22
25 void performLayout() { 23 void performLayout() {
26 width = constraints.constrainWidth(desiredWidth); 24 width = constraints.constrainWidth(desiredWidth);
27 height = constraints.constrainHeight(desiredHeight); 25 height = constraints.constrainHeight(desiredHeight);
28 } 26 }
29 27
30 void handlePointer(PointerEvent event) { 28 void handlePointer(PointerEvent event) {
31 if (event.type == 'pointerdown') 29 if (event.type == 'pointerdown')
32 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); 30 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000);
(...skipping 19 matching lines...) Expand all
52 andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola 50 andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola
53 alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl. 51 alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl.
54 Pancetta meatball tongue tenderloin rump tail jowl boudin."""; 52 Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
55 53
56 child = new RenderParagraph(meatyString); 54 child = new RenderParagraph(meatyString);
57 root.add(child); 55 root.add(child);
58 child.parentData.flex = 1; 56 child.parentData.flex = 1;
59 57
60 app = new AppView(root); 58 app = new AppView(root);
61 } 59 }
OLDNEW
« 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