EditingScope class
Tracks elements being edited in its subtree (e.g. a GuardedForm with changes). May be used to delay a data update while user is editing, so that the input isn't lost when the subtree is recreated. GuardedForm (and so SubmitFormBuilder) automatically registers to the closest EditingScope when changed. Nested scopes are supported: an element being edited also marks all ancestor scopes as editing. Must be placed above the subtree that may be recreated. Parent scope is resolved once: moving a scope or a GuardedForm to another place in the tree (with a GlobalKey) isn't supported.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- EditingScope
Constructors
-
EditingScope({Key? key, ValueChanged<
bool> ? onChanged, required Widget child}) -
const
Properties
- child → Widget
-
The subtree to track.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onChanged
→ ValueChanged<
bool> ? -
Called when EditingScopeState.isEditing changes.
Called asynchronously (in a microtask), so it's safe to call State.setState from it.
Only called if EditingScopeState.isEditing actually changed since last call (e.g. an unregister immediately followed by a register is ignored).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → EditingScopeState -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
Static Methods
-
maybeOf(
BuildContext context) → EditingScopeState? - Returns the closest EditingScope ancestor, or null if there is none. Doesn't register a dependency, so it may be called from State.initState.