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

Side by Side Diff: sky/sdk/lib/widgets/basic.dart

Issue 1227093010: Add an AspectRatio widget for doing proportional height sizing (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
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:async'; 5 import 'dart:async';
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 import 'package:vector_math/vector_math.dart'; 8 import 'package:vector_math/vector_math.dart';
9 9
10 import 'package:sky/mojo/asset_bundle.dart'; 10 import 'package:sky/mojo/asset_bundle.dart';
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 RenderConstrainedBox createNode() => new RenderConstrainedBox(additionalConstr aints: constraints); 211 RenderConstrainedBox createNode() => new RenderConstrainedBox(additionalConstr aints: constraints);
212 RenderConstrainedBox get root => super.root; 212 RenderConstrainedBox get root => super.root;
213 213
214 void syncRenderObject(ConstrainedBox old) { 214 void syncRenderObject(ConstrainedBox old) {
215 super.syncRenderObject(old); 215 super.syncRenderObject(old);
216 root.additionalConstraints = constraints; 216 root.additionalConstraints = constraints;
217 } 217 }
218 } 218 }
219 219
220 class AspectRatio extends OneChildRenderObjectWrapper {
221 AspectRatio({ String key, this.aspectRatio, Widget child })
222 : super(key: key, child: child);
223
224 final double aspectRatio;
225
226 RenderAspectRatio createNode() => new RenderAspectRatio(aspectRatio: aspectRat io);
227 RenderAspectRatio get root => super.root;
228
229 void syncRenderObject(AspectRatio old) {
230 super.syncRenderObject(old);
231 root.aspectRatio = aspectRatio;
232 }
233 }
234
220 class ShrinkWrapWidth extends OneChildRenderObjectWrapper { 235 class ShrinkWrapWidth extends OneChildRenderObjectWrapper {
221 ShrinkWrapWidth({ String key, this.stepWidth, this.stepHeight, Widget child }) 236 ShrinkWrapWidth({ String key, this.stepWidth, this.stepHeight, Widget child })
222 : super(key: key, child: child); 237 : super(key: key, child: child);
223 238
224 final double stepWidth; 239 final double stepWidth;
225 final double stepHeight; 240 final double stepHeight;
226 241
227 RenderShrinkWrapWidth createNode() => new RenderShrinkWrapWidth(); 242 RenderShrinkWrapWidth createNode() => new RenderShrinkWrapWidth();
228 RenderShrinkWrapWidth get root => super.root; 243 RenderShrinkWrapWidth get root => super.root;
229 244
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 } 584 }
570 585
571 void remove() { 586 void remove() {
572 RenderObjectWrapper ancestor = findAncestorRenderObjectWrapper(); 587 RenderObjectWrapper ancestor = findAncestorRenderObjectWrapper();
573 assert(ancestor is RenderObjectWrapper); 588 assert(ancestor is RenderObjectWrapper);
574 assert(ancestor.root == root.parent); 589 assert(ancestor.root == root.parent);
575 ancestor.detachChildRoot(this); 590 ancestor.detachChildRoot(this);
576 super.remove(); 591 super.remove();
577 } 592 }
578 } 593 }
OLDNEW
« sky/sdk/example/address_book/lib/main.dart ('K') | « sky/sdk/lib/rendering/box.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698