Skip to main content

ButtonStyleButtonData

Struct ButtonStyleButtonData 

Source
pub struct ButtonStyleButtonData {
Show 15 fields pub key: Option<KeyRef>, pub on_pressed: Option<Listener>, pub on_long_press: Option<Listener>, pub on_hover: Option<ValueChanged<bool>>, pub on_focus_change: Option<ValueChanged<bool>>, pub style: Option<ButtonStyle>, pub clip_behavior: Option<Clip>, pub focus_node: Option<FocusNodeRef>, pub autofocus: bool, pub states_controller: Option<Ref<MaterialStatesController>>, pub is_selected: Option<bool>, pub is_semantic_button: Option<bool>, pub icon_alignment: Option<IconAlignment>, pub tooltip: Option<String>, pub child: Option<WidgetRef>,
}
Expand description

The fields of Dart’s abstract ButtonStyleButton, which every subclass carries under the field button_style_button.

Fields§

§key: Option<KeyRef>§on_pressed: Option<Listener>

Called when the button is tapped or otherwise activated.

If this callback and on_long_press are null, then the button will be disabled.

See also:

§on_long_press: Option<Listener>

Called when the button is long-pressed.

If this callback and on_pressed are null, then the button will be disabled.

See also:

§on_hover: Option<ValueChanged<bool>>

Called when a pointer enters or exits the button response area.

The value passed to the callback is true if a pointer has entered this part of the material and false if a pointer has exited this part of the material.

§on_focus_change: Option<ValueChanged<bool>>

Handler called when the focus changes.

Called with true if this widget’s node gains focus, and false if it loses focus.

§style: Option<ButtonStyle>

Customizes this button’s appearance.

Non-null properties of this style override the corresponding properties in ButtonStyleButton::theme_style_of and ButtonStyleButton::default_style_of. WidgetStatePropertys that resolve to non-null values will similarly override the corresponding WidgetStatePropertys in ButtonStyleButton::theme_style_of and ButtonStyleButton::default_style_of.

Null by default.

§clip_behavior: Option<Clip>

The content will be clipped (or not) according to this option.

Defaults to Clip::None unless ButtonStyle::background_builder or ButtonStyle::foreground_builder is specified. In those cases the default is Clip::AntiAlias.

§focus_node: Option<FocusNodeRef>

An optional focus node to use as the focus node for this widget.

§autofocus: bool

True if this widget will be selected as the initial focus when no other node in its scope is currently focused.

§states_controller: Option<Ref<MaterialStatesController>>

Represents the interactive “state” of this widget in terms of a set of WidgetStates, like WidgetState::Pressed and WidgetState::Focused.

Classes based on this one can provide their own MaterialStatesController to which they’ve added listeners. They can also update the controller’s value however, this may only be done when it’s safe to call State::set_state, like in an event handler.

§is_selected: Option<bool>

Whether this button is in the selected state.

If null, the button is not selectable. Otherwise, this value is the source of truth for the button’s selected state. It is written to WidgetState::Selected when the button is first built, when a new states_controller is provided, and whenever is_selected changes. It also controls the button’s selected semantics. Tapping the button does not change is_selected; update it in on_pressed to create a toggle button.

Avoid also updating WidgetState::Selected through states_controller. That changes only the button’s appearance, not its semantics, and is overwritten the next time is_selected changes.

§is_semantic_button: Option<bool>

Determine whether this subtree represents a button.

If this is null, the screen reader will not announce “button” when this is focused. This is useful for MenuItemButton and SubmenuButton when we traverse the menu system.

Defaults to true.

§icon_alignment: Option<IconAlignment>
👎Deprecated:

Remove this parameter as it is now ignored. Use ButtonStyle.iconAlignment instead. This feature was deprecated after v3.28.0-1.0.pre.

Determines the alignment of the icon within the button; see IconAlignment.

§tooltip: Option<String>

Text that describes the action that will occur when the button is pressed or hovered over.

This text is displayed when the user long-presses or hovers over the button in a tooltip. This string is also used for accessibility.

If null, the button will not display a tooltip.

§child: Option<WidgetRef>

Typically the button’s label.

The widget below this widget in the tree.

Implementations§

Source§

impl ButtonStyleButtonData

Source

pub fn new( on_pressed: Option<Listener>, child: Option<WidgetRef>, ) -> ButtonStyleButtonData

The fields a subclass’s constructor passes on, with Dart’s required onPressed and child; the rest start at the base class’s defaults and are set by button_style_button_setters!.

Source

pub fn enabled(&self) -> bool

Whether the button is enabled or disabled; see ButtonStyleButton::enabled.

Trait Implementations§

Source§

impl Clone for ButtonStyleButtonData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ButtonStyleButtonData

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ButtonStyleButtonData

§

impl !Send for ButtonStyleButtonData

§

impl !Sync for ButtonStyleButtonData

§

impl !UnwindSafe for ButtonStyleButtonData

§

impl Forget for ButtonStyleButtonData

§

impl Freeze for ButtonStyleButtonData
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: Freeze, *const RcInner<dyn InteractiveInkFeatureFactory> is !null: Freeze, PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: Freeze, &'static FocusNodeVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, PhantomData<fn() -> WidgetStatesController>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for ButtonStyleButtonData

§

impl Unpin for ButtonStyleButtonData

§

impl UnsafeUnpin for ButtonStyleButtonData
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: UnsafeUnpin, *const RcInner<dyn InteractiveInkFeatureFactory> is !null: UnsafeUnpin, PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: UnsafeUnpin, &'static FocusNodeVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, PhantomData<fn() -> WidgetStatesController>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>