ThreeStateView class
Bootstraps a render tree that is rendered into the provided FlutterView.
You need to provide this ThreeStateView into ThreeStateScope,
to update the state.
The content rendered into that view is determined by the provided:
- Splash state -
buildSplash. - App state -
buildApp. - Exit state -
buildExit.
Descendants within the same LookupBoundary can look up the view they are rendered into via View.of and View.maybeOf.
The provided content (builders) is wrapped in a MediaQuery constructed from the given view, a FocusScope, and a RawView widget.
For most use cases, using MediaQuery.of, or its associated "...Of" methods are a more appropriate way of obtaining the information that a FlutterView exposes. For example, using MediaQuery.sizeOf will expose the logical device size (MediaQueryData.size) rather than the physical size (FlutterView.physicalSize). Similarly, while FlutterView.padding conveys the information from the operating system, the MediaQueryData.padding attribute (obtained from MediaQuery.paddingOf) further adjusts this information to be aware of the context of the widget; e.g. the Scaffold widget adjusts the values for its various children.
Each FlutterView can be associated with at most one View or RawView widget in the widget tree. Two or more View or RawView widgets configured with the same FlutterView must never exist within the same widget tree at the same time. This limitation is enforced by a GlobalObjectKey that derives its identity from the view provided to this widget.
Since the View widget bootstraps its own independent render tree using its embedded RawView, neither it nor any of its descendants will insert a RenderObject into an existing render tree. Therefore, the View widget can only be used in those parts of the widget tree where it is not required to participate in the construction of the surrounding render tree. In other words, the widget may only be used in a non-rendering zone of the widget tree (see WidgetsBinding for a definition of rendering and non-rendering zones).
In practical terms, the widget is typically used at the root of the widget tree outside of any other View or RawView widget, as a child of a ViewCollection widget, or in the ViewAnchor.view slot of a ViewAnchor widget. It is not required to be a direct child, though, since other non-RenderObjectWidgets (e.g. InheritedWidgets, Builders, or StatefulWidgets/StatelessWidgets that only produce non-RenderObjectWidgets) are allowed to be present between those widgets and the View widget.
See also:
- RawView, the workhorse that View uses to create the render tree, but without the MediaQuery and FocusScope that View adds.
- Element.debugExpectsRenderObjectForSlot, which defines whether a View widget is allowed in a given child slot.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ThreeStateView
Constructors
-
ThreeStateView({Key? key, required FlutterView view, required Widget builder(BuildContext, ThreeState), required Widget transitionBuilder(Widget? fromWidget, Widget toWidget, ThreeState from, ThreeState to, Animation<
double> ), required Curve transitionCurve, required Duration transitionDuration, required ValueNotifier<ThreeState> stateNotifier}) -
Create a View widget to bootstrap a render tree that is rendered into
the provided FlutterView.
const
Properties
- builder → Widget Function(BuildContext, ThreeState)
-
The widget builder which returns widget to insert below this widget in the
tree, which will be drawn into the view.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateNotifier
→ ValueNotifier<
ThreeState> -
final
-
transitionBuilder
→ Widget Function(Widget? fromWidget, Widget toWidget, ThreeState from, ThreeState to, Animation<
double> ) -
final
- transitionCurve → Curve
-
final
- transitionDuration → Duration
-
final
- view → FlutterView
-
The FlutterView into which a builder child is drawn.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited