Commit d717be94 authored by Adam Barth's avatar Adam Barth

Add findRenderObject to BuildContext

parent ee458328
...@@ -291,6 +291,9 @@ abstract class State<T extends StatefulComponent> { ...@@ -291,6 +291,9 @@ abstract class State<T extends StatefulComponent> {
/// Pointer to the owner Element object /// Pointer to the owner Element object
StatefulComponentElement _element; 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 /// Called when this object is inserted into the tree. Override this function
/// to perform initialization that depends on the location at which this /// to perform initialization that depends on the location at which this
/// object was inserted into the tree or on the widget configuration object. /// object was inserted into the tree or on the widget configuration object.
...@@ -392,6 +395,7 @@ typedef void ElementVisitor(Element element); ...@@ -392,6 +395,7 @@ typedef void ElementVisitor(Element element);
abstract class BuildContext { abstract class BuildContext {
InheritedWidget inheritedWidgetOfType(Type targetType); InheritedWidget inheritedWidgetOfType(Type targetType);
RenderObject findRenderObject();
} }
/// Elements are the instantiations of Widget configurations. /// Elements are the instantiations of Widget configurations.
...@@ -601,6 +605,8 @@ abstract class Element<T extends Widget> implements BuildContext { ...@@ -601,6 +605,8 @@ abstract class Element<T extends Widget> implements BuildContext {
return ancestor?.widget; return ancestor?.widget;
} }
RenderObject findRenderObject() => renderObject;
void dependenciesChanged() { void dependenciesChanged() {
assert(false); assert(false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment