Skip to main content

AutofillGroup

Struct AutofillGroup 

Source
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:

Fields§

§key: Option<KeyRef>§child: WidgetRef

The widget below this widget in the tree.

§on_dispose_action: AutofillContextAction

The 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

Source

pub fn new<K>(child: impl IntoWidget<K>) -> AutofillGroup

Creates a scope for autofillable input fields.

Source

pub fn key(self, key: KeyRef) -> AutofillGroup

Dart AutofillGroup(key:).

Source

pub fn on_dispose_action( self, on_dispose_action: AutofillContextAction, ) -> AutofillGroup

Dart AutofillGroup(onDisposeAction:).

Source

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:

Source

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:

Trait Implementations§

Source§

impl Debug for AutofillGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for AutofillGroup

Source§

type State = AutofillGroupState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> AutofillGroupState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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 debug_check_constructor(&self)

Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Source§

fn type_name(&self) -> &'static str

See 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
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for AutofillGroup

§

impl Unpin for AutofillGroup
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for AutofillGroup
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>