Add findRenderObject to BuildContext
This commit is contained in:
parent
ee45832818
commit
d717be946a
@ -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);
|
|||||||
|
|
||||||
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 {
|
|||||||
return ancestor?.widget;
|
return ancestor?.widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderObject findRenderObject() => renderObject;
|
||||||
|
|
||||||
void dependenciesChanged() {
|
void dependenciesChanged() {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user