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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/widgets/basic.dart
diff --git a/sky/sdk/lib/widgets/basic.dart b/sky/sdk/lib/widgets/basic.dart
index 85f33f51061ca80adfaf6a156fb5f708c2ba0f90..8832969f2d0c2a622d9b60e673b0f438dc82f01f 100644
--- a/sky/sdk/lib/widgets/basic.dart
+++ b/sky/sdk/lib/widgets/basic.dart
@@ -217,6 +217,21 @@ class ConstrainedBox extends OneChildRenderObjectWrapper {
}
}
+class AspectRatio extends OneChildRenderObjectWrapper {
+ AspectRatio({ String key, this.aspectRatio, Widget child })
+ : super(key: key, child: child);
+
+ final double aspectRatio;
+
+ RenderAspectRatio createNode() => new RenderAspectRatio(aspectRatio: aspectRatio);
+ RenderAspectRatio get root => super.root;
+
+ void syncRenderObject(AspectRatio old) {
+ super.syncRenderObject(old);
+ root.aspectRatio = aspectRatio;
+ }
+}
+
class ShrinkWrapWidth extends OneChildRenderObjectWrapper {
ShrinkWrapWidth({ String key, this.stepWidth, this.stepHeight, Widget child })
: super(key: key, child: child);
« 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