pub struct AutofillGroup {
pub key: Option<KeyRef>,
pub child: WidgetRef,
pub on_dispose_action: AutofillContextAction,
}Expand description
An AutofillScope widget that groups AutofillClients together.
AutofillClients that share the same closest AutofillGroup ancestor must
be built together, and they will be autofilled together.
The AutofillGroup widget only knows about AutofillClients registered to
it using the AutofillGroupState::register API. Typically, AutofillGroup
will not pick up AutofillClients that are not mounted, for example, an
AutofillClient within a Scrollable that has never been scrolled into the
viewport. To workaround this problem, ensure clients in the same
AutofillGroup are built together.
The topmost AutofillGroup widgets (the ones that are closest to the root
widget) can be used to clean up the current autofill context when the
current autofill context is no longer relevant.
By default, on_dispose_action is set to
AutofillContextAction::Commit, in which case when any of the topmost
AutofillGroups is being disposed, the platform will be informed to save
the user input from the current autofill context, then the current autofill
context will be destroyed, to free resources. You can, for example, wrap a
route that contains a Form full of autofillable input fields in an
AutofillGroup, so the user input of the Form can be saved for future
autofill by the platform.
See also:
AutofillContextAction, an enum that contains predefined autofill context clean up actions to be run when a topmostAutofillGroupis disposed.
Fields§
§key: Option<KeyRef>See StatefulWidget::key.
child: WidgetRefThe widget below this widget in the tree.
on_dispose_action: AutofillContextActionThe AutofillContextAction to be run when this AutofillGroup is the
topmost AutofillGroup and it’s being disposed, in order to clean up the
current autofill context.
Defaults to AutofillContextAction::Commit, which prompts the platform to
save the user input and destroy the current autofill context.
Implementations§
Source§impl AutofillGroup
impl AutofillGroup
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> AutofillGroup
pub fn new<K>(child: impl IntoWidget<K>) -> AutofillGroup
Creates a scope for autofillable input fields.
Sourcepub fn key(self, key: KeyRef) -> AutofillGroup
pub fn key(self, key: KeyRef) -> AutofillGroup
Dart AutofillGroup(key:).
Sourcepub fn on_dispose_action(
self,
on_dispose_action: AutofillContextAction,
) -> AutofillGroup
pub fn on_dispose_action( self, on_dispose_action: AutofillContextAction, ) -> AutofillGroup
Dart AutofillGroup(onDisposeAction:).
Sourcepub fn maybe_of(
app: &mut App,
context: BuildContext,
) -> Option<Handle<AutofillGroupState>>
pub fn maybe_of( app: &mut App, context: BuildContext, ) -> Option<Handle<AutofillGroupState>>
Returns the AutofillGroupState of the closest AutofillGroup widget
which encloses the given context, or null if one cannot be found.
Calling this method will create a dependency on the closest
AutofillGroup in the [context], if there is one.
See also:
AutofillGroup::of, which is similar to this method, but asserts if anAutofillGroupcannot be found.EditableTextState, where this method is used to retrieve the closestAutofillGroupState.
Sourcepub fn of(app: &mut App, context: BuildContext) -> Handle<AutofillGroupState>
pub fn of(app: &mut App, context: BuildContext) -> Handle<AutofillGroupState>
Returns the AutofillGroupState of the closest AutofillGroup widget
which encloses the given context.
If no instance is found, this method panics.
Calling this method will create a dependency on the closest
AutofillGroup in the [context].
See also:
AutofillGroup::maybe_of, which is similar to this method, but returns null if anAutofillGroupcannot be found.EditableTextState, where this method is used to retrieve the closestAutofillGroupState.
Trait Implementations§
Source§impl Debug for AutofillGroup
impl Debug for AutofillGroup
Source§impl StatefulWidget for AutofillGroup
impl StatefulWidget for AutofillGroup
Source§type State = AutofillGroupState
type State = AutofillGroupState
Source§fn create_state(&self) -> AutofillGroupState
fn create_state(&self) -> AutofillGroupState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for AutofillGroup
impl !Send for AutofillGroup
impl !Sync for AutofillGroup
impl !UnwindSafe for AutofillGroup
impl Forget for AutofillGroup
impl Freeze for AutofillGroup
impl Move for AutofillGroup
impl Unpin for AutofillGroup
impl UnsafeUnpin for AutofillGroupwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.