From d717be946a139eb1da54d7e73a6e53394026a240 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 25 Sep 2015 13:11:39 -0700 Subject: [PATCH] Add findRenderObject to BuildContext --- packages/flutter/lib/src/fn3/framework.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/flutter/lib/src/fn3/framework.dart b/packages/flutter/lib/src/fn3/framework.dart index caa2cbf4b8..d5b172c767 100644 --- a/packages/flutter/lib/src/fn3/framework.dart +++ b/packages/flutter/lib/src/fn3/framework.dart @@ -291,6 +291,9 @@ abstract class State { /// Pointer to the owner Element object StatefulComponentElement _element; + /// The context in which this object will be built + BuildContext get context => _element; + /// Called when this object is inserted into the tree. Override this function /// to perform initialization that depends on the location at which this /// object was inserted into the tree or on the widget configuration object. @@ -392,6 +395,7 @@ typedef void ElementVisitor(Element element); abstract class BuildContext { InheritedWidget inheritedWidgetOfType(Type targetType); + RenderObject findRenderObject(); } /// Elements are the instantiations of Widget configurations. @@ -601,6 +605,8 @@ abstract class Element implements BuildContext { return ancestor?.widget; } + RenderObject findRenderObject() => renderObject; + void dependenciesChanged() { assert(false); }