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>See Widget::key.
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:
ButtonStyleButton::enabled, which is true if the button is enabled.
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:
ButtonStyleButton::enabled, which is true if the button is enabled.
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: boolTrue 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.
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>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
impl ButtonStyleButtonData
Sourcepub fn new(
on_pressed: Option<Listener>,
child: Option<WidgetRef>,
) -> ButtonStyleButtonData
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!.
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Whether the button is enabled or disabled; see ButtonStyleButton::enabled.