@@ -479,8 +479,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
479
479
}
480
480
481
481
Future <void > _forceRebuild () {
482
- if (renderViewElement != null ) {
483
- buildOwner! .reassemble (renderViewElement ! , null );
482
+ if (rootElement != null ) {
483
+ buildOwner! .reassemble (rootElement ! , null );
484
484
return endOfFrame;
485
485
}
486
486
return Future <void >.value ();
@@ -889,8 +889,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
889
889
}
890
890
891
891
try {
892
- if (renderViewElement != null ) {
893
- buildOwner! .buildScope (renderViewElement ! );
892
+ if (rootElement != null ) {
893
+ buildOwner! .buildScope (rootElement ! );
894
894
}
895
895
super .drawFrame ();
896
896
buildOwner! .finalizeTree ();
@@ -914,12 +914,20 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
914
914
}
915
915
}
916
916
917
- /// The [Element] that is at the root of the hierarchy (and which wraps the
918
- /// [RenderView] object at the root of the rendering hierarchy).
917
+ /// The [Element] that is at the root of the element tree hierarchy.
919
918
///
920
919
/// This is initialized the first time [runApp] is called.
921
- Element ? get renderViewElement => _renderViewElement;
922
- Element ? _renderViewElement;
920
+ Element ? get rootElement => _rootElement;
921
+ Element ? _rootElement;
922
+
923
+ /// Deprecated. Will be removed in a future version of Flutter.
924
+ ///
925
+ /// Use [rootElement] instead.
926
+ @Deprecated (
927
+ 'Use rootElement instead. '
928
+ 'This feature was deprecated after v3.9.0-16.0.pre.'
929
+ )
930
+ Element ? get renderViewElement => rootElement;
923
931
924
932
bool _readyToProduceFrames = false ;
925
933
@@ -951,7 +959,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
951
959
});
952
960
}
953
961
954
- /// Takes a widget and attaches it to the [renderViewElement ] , creating it if
962
+ /// Takes a widget and attaches it to the [rootElement ] , creating it if
955
963
/// necessary.
956
964
///
957
965
/// This is called by [runApp] to configure the widget tree.
@@ -961,23 +969,23 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
961
969
/// * [RenderObjectToWidgetAdapter.attachToRenderTree] , which inflates a
962
970
/// widget and attaches it to the render tree.
963
971
void attachRootWidget (Widget rootWidget) {
964
- final bool isBootstrapFrame = renderViewElement == null ;
972
+ final bool isBootstrapFrame = rootElement == null ;
965
973
_readyToProduceFrames = true ;
966
- _renderViewElement = RenderObjectToWidgetAdapter <RenderBox >(
974
+ _rootElement = RenderObjectToWidgetAdapter <RenderBox >(
967
975
container: renderView,
968
976
debugShortDescription: '[root]' ,
969
977
child: rootWidget,
970
- ).attachToRenderTree (buildOwner! , renderViewElement as RenderObjectToWidgetElement <RenderBox >? );
978
+ ).attachToRenderTree (buildOwner! , rootElement as RenderObjectToWidgetElement <RenderBox >? );
971
979
if (isBootstrapFrame) {
972
980
SchedulerBinding .instance.ensureVisualUpdate ();
973
981
}
974
982
}
975
983
976
- /// Whether the [renderViewElement ] has been initialized.
984
+ /// Whether the [rootElement ] has been initialized.
977
985
///
978
986
/// This will be false until [runApp] is called (or [WidgetTester.pumpWidget]
979
987
/// is called in the context of a [TestWidgetsFlutterBinding] ).
980
- bool get isRootWidgetAttached => _renderViewElement != null ;
988
+ bool get isRootWidgetAttached => _rootElement != null ;
981
989
982
990
@override
983
991
Future <void > performReassemble () {
@@ -986,8 +994,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
986
994
return true ;
987
995
}());
988
996
989
- if (renderViewElement != null ) {
990
- buildOwner! .reassemble (renderViewElement ! , BindingBase .debugReassembleConfig);
997
+ if (rootElement != null ) {
998
+ buildOwner! .reassemble (rootElement ! , BindingBase .debugReassembleConfig);
991
999
}
992
1000
return super .performReassemble ();
993
1001
}
@@ -1069,8 +1077,8 @@ String _debugDumpAppString() {
1069
1077
const String mode = kDebugMode ? 'DEBUG MODE' : kReleaseMode ? 'RELEASE MODE' : 'PROFILE MODE' ;
1070
1078
final StringBuffer buffer = StringBuffer ();
1071
1079
buffer.writeln ('${WidgetsBinding .instance .runtimeType } - $mode ' );
1072
- if (WidgetsBinding .instance.renderViewElement != null ) {
1073
- buffer.writeln (WidgetsBinding .instance.renderViewElement ! .toStringDeep ());
1080
+ if (WidgetsBinding .instance.rootElement != null ) {
1081
+ buffer.writeln (WidgetsBinding .instance.rootElement ! .toStringDeep ());
1074
1082
} else {
1075
1083
buffer.writeln ('<no tree currently mounted>' );
1076
1084
}
@@ -1148,7 +1156,7 @@ class RenderObjectToWidgetAdapter<T extends RenderObject> extends RenderObjectWi
1148
1156
String toStringShort () => debugShortDescription ?? super .toStringShort ();
1149
1157
}
1150
1158
1151
- /// A [RootRenderObjectElement] that is hosted by a [RenderObject] .
1159
+ /// The root of the element tree that is hosted by a [RenderObject] .
1152
1160
///
1153
1161
/// This element class is the instantiation of a [RenderObjectToWidgetAdapter]
1154
1162
/// widget. It can be used only as the root of an [Element] tree (it cannot be
@@ -1158,7 +1166,7 @@ class RenderObjectToWidgetAdapter<T extends RenderObject> extends RenderObjectWi
1158
1166
/// whose container is the [RenderView] that connects to the Flutter engine. In
1159
1167
/// this usage, it is normally instantiated by the bootstrapping logic in the
1160
1168
/// [WidgetsFlutterBinding] singleton created by [runApp] .
1161
- class RenderObjectToWidgetElement <T extends RenderObject > extends RootRenderObjectElement {
1169
+ class RenderObjectToWidgetElement <T extends RenderObject > extends RenderObjectElement with RootElementMixin {
1162
1170
/// Creates an element that is hosted by a [RenderObject] .
1163
1171
///
1164
1172
/// The [RenderObject] created by this element is not automatically set as a
0 commit comments