pub struct MaterialButton {Show 32 fields
pub key: Option<KeyRef>,
pub on_pressed: Option<Listener>,
pub on_long_press: Option<Listener>,
pub on_highlight_changed: Option<ValueChanged<bool>>,
pub mouse_cursor: Option<MouseCursorRef>,
pub text_theme: Option<ButtonTextTheme>,
pub text_color: Option<Color>,
pub disabled_text_color: Option<Color>,
pub color: Option<Color>,
pub disabled_color: Option<Color>,
pub splash_color: Option<Color>,
pub focus_color: Option<Color>,
pub hover_color: Option<Color>,
pub highlight_color: Option<Color>,
pub elevation: Option<f64>,
pub hover_elevation: Option<f64>,
pub focus_elevation: Option<f64>,
pub highlight_elevation: Option<f64>,
pub disabled_elevation: Option<f64>,
pub color_brightness: Option<Brightness>,
pub child: Option<WidgetRef>,
pub padding: Option<EdgeInsetsGeometry>,
pub visual_density: Option<VisualDensity>,
pub shape: Option<ShapeBorderRef>,
pub clip_behavior: Clip,
pub focus_node: Option<FocusNodeRef>,
pub autofocus: bool,
pub animation_duration: Option<Duration>,
pub material_tap_target_size: Option<MaterialTapTargetSize>,
pub min_width: Option<f64>,
pub height: Option<f64>,
pub enable_feedback: bool,
}Expand description
A Material Design button.
To create a custom Material button consider using TextButton, ElevatedButton, or
OutlinedButton.
The elevation, hover_elevation,
focus_elevation, highlight_elevation
and disabled_elevation arguments must be non-negative, if
specified.
Fields§
§key: Option<KeyRef>§on_pressed: Option<Listener>The callback that is called when the button is tapped or otherwise activated.
If this callback and on_long_press are null, then the button
will be disabled.
on_long_press: Option<Listener>The callback that is called when the button is long-pressed.
on_highlight_changed: Option<ValueChanged<bool>>Called by the underlying InkWell widget’s onHighlightChanged callback.
mouse_cursor: Option<MouseCursorRef>The cursor for a mouse pointer when it enters or is hovering over the button.
text_theme: Option<ButtonTextTheme>Defines the button’s base colors, and the defaults for the button’s minimum size, internal padding, and shape.
text_color: Option<Color>The color to use for this button’s text.
disabled_text_color: Option<Color>The color to use for this button’s text when the button is disabled.
color: Option<Color>The button’s fill color while it is in its default (unpressed, enabled) state.
disabled_color: Option<Color>The fill color of the button when the button is disabled.
splash_color: Option<Color>The splash color of the button’s InkWell.
focus_color: Option<Color>The fill color of the button’s Material when it has the input focus.
hover_color: Option<Color>The fill color of the button’s Material when a pointer is hovering over it.
highlight_color: Option<Color>The highlight color of the button’s InkWell.
elevation: Option<f64>The z-coordinate at which to place this button relative to its parent.
hover_elevation: Option<f64>The elevation for the button’s Material when the button is enabled and a pointer is
hovering over it.
focus_elevation: Option<f64>The elevation for the button’s Material when the button is enabled and has the input
focus.
highlight_elevation: Option<f64>The elevation for the button’s Material relative to its parent when the button is
enabled and pressed.
disabled_elevation: Option<f64>The elevation for the button’s Material relative to its parent when the button is not
enabled.
color_brightness: Option<Brightness>The theme brightness to use for this button.
child: Option<WidgetRef>The button’s label.
padding: Option<EdgeInsetsGeometry>The internal padding for the button’s child.
visual_density: Option<VisualDensity>Defines how compact the button’s layout will be.
shape: Option<ShapeBorderRef>The shape of the button’s Material.
clip_behavior: ClipHow to clip the button’s Material.
focus_node: Option<FocusNodeRef>The focus node of the button.
autofocus: boolWhether the button will be selected as the initial focus when no other node in its scope is currently focused.
animation_duration: Option<Duration>The duration of animated changes for shape and elevation.
material_tap_target_size: Option<MaterialTapTargetSize>Configures the minimum size of the tap target.
min_width: Option<f64>The smallest horizontal extent that the button will occupy.
height: Option<f64>The vertical extent of the button.
enable_feedback: boolWhether detected gestures should provide acoustic and/or haptic feedback.
Implementations§
Source§impl MaterialButton
impl MaterialButton
Sourcepub fn new(on_pressed: Option<Listener>) -> MaterialButton
pub fn new(on_pressed: Option<Listener>) -> MaterialButton
Creates a Material Design button; Dart’s optional named arguments are the setters.
Sourcepub fn key(self, key: KeyRef) -> MaterialButton
pub fn key(self, key: KeyRef) -> MaterialButton
Dart MaterialButton(key:).
Sourcepub fn on_long_press(self, on_long_press: Listener) -> MaterialButton
pub fn on_long_press(self, on_long_press: Listener) -> MaterialButton
Dart MaterialButton(onLongPress:).
Sourcepub fn on_highlight_changed(
self,
on_highlight_changed: ValueChanged<bool>,
) -> MaterialButton
pub fn on_highlight_changed( self, on_highlight_changed: ValueChanged<bool>, ) -> MaterialButton
Dart MaterialButton(onHighlightChanged:).
Sourcepub fn mouse_cursor(self, mouse_cursor: MouseCursorRef) -> MaterialButton
pub fn mouse_cursor(self, mouse_cursor: MouseCursorRef) -> MaterialButton
Dart MaterialButton(mouseCursor:).
Sourcepub fn text_theme(self, text_theme: ButtonTextTheme) -> MaterialButton
pub fn text_theme(self, text_theme: ButtonTextTheme) -> MaterialButton
Dart MaterialButton(textTheme:).
Sourcepub fn text_color(self, text_color: Color) -> MaterialButton
pub fn text_color(self, text_color: Color) -> MaterialButton
Dart MaterialButton(textColor:).
Sourcepub fn disabled_text_color(self, disabled_text_color: Color) -> MaterialButton
pub fn disabled_text_color(self, disabled_text_color: Color) -> MaterialButton
Dart MaterialButton(disabledTextColor:).
Sourcepub fn color(self, color: Color) -> MaterialButton
pub fn color(self, color: Color) -> MaterialButton
Dart MaterialButton(color:).
Sourcepub fn disabled_color(self, disabled_color: Color) -> MaterialButton
pub fn disabled_color(self, disabled_color: Color) -> MaterialButton
Dart MaterialButton(disabledColor:).
Sourcepub fn splash_color(self, splash_color: Color) -> MaterialButton
pub fn splash_color(self, splash_color: Color) -> MaterialButton
Dart MaterialButton(splashColor:).
Sourcepub fn focus_color(self, focus_color: Color) -> MaterialButton
pub fn focus_color(self, focus_color: Color) -> MaterialButton
Dart MaterialButton(focusColor:).
Sourcepub fn hover_color(self, hover_color: Color) -> MaterialButton
pub fn hover_color(self, hover_color: Color) -> MaterialButton
Dart MaterialButton(hoverColor:).
Sourcepub fn highlight_color(self, highlight_color: Color) -> MaterialButton
pub fn highlight_color(self, highlight_color: Color) -> MaterialButton
Dart MaterialButton(highlightColor:).
Sourcepub fn color_brightness(self, color_brightness: Brightness) -> MaterialButton
pub fn color_brightness(self, color_brightness: Brightness) -> MaterialButton
Dart MaterialButton(colorBrightness:).
Sourcepub fn elevation(self, elevation: f64) -> MaterialButton
pub fn elevation(self, elevation: f64) -> MaterialButton
Dart MaterialButton(elevation:).
Sourcepub fn focus_elevation(self, focus_elevation: f64) -> MaterialButton
pub fn focus_elevation(self, focus_elevation: f64) -> MaterialButton
Dart MaterialButton(focusElevation:).
Sourcepub fn hover_elevation(self, hover_elevation: f64) -> MaterialButton
pub fn hover_elevation(self, hover_elevation: f64) -> MaterialButton
Dart MaterialButton(hoverElevation:).
Sourcepub fn highlight_elevation(self, highlight_elevation: f64) -> MaterialButton
pub fn highlight_elevation(self, highlight_elevation: f64) -> MaterialButton
Dart MaterialButton(highlightElevation:).
Sourcepub fn disabled_elevation(self, disabled_elevation: f64) -> MaterialButton
pub fn disabled_elevation(self, disabled_elevation: f64) -> MaterialButton
Dart MaterialButton(disabledElevation:).
Sourcepub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> MaterialButton
pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> MaterialButton
Dart MaterialButton(padding:).
Sourcepub fn visual_density(self, visual_density: VisualDensity) -> MaterialButton
pub fn visual_density(self, visual_density: VisualDensity) -> MaterialButton
Dart MaterialButton(visualDensity:).
Sourcepub fn shape(self, shape: impl Into<ShapeBorderRef>) -> MaterialButton
pub fn shape(self, shape: impl Into<ShapeBorderRef>) -> MaterialButton
Dart MaterialButton(shape:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> MaterialButton
pub fn clip_behavior(self, clip_behavior: Clip) -> MaterialButton
Dart MaterialButton(clipBehavior:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> MaterialButton
pub fn focus_node(self, focus_node: FocusNodeRef) -> MaterialButton
Dart MaterialButton(focusNode:).
Sourcepub fn autofocus(self, autofocus: bool) -> MaterialButton
pub fn autofocus(self, autofocus: bool) -> MaterialButton
Dart MaterialButton(autofocus:).
Sourcepub fn animation_duration(self, animation_duration: Duration) -> MaterialButton
pub fn animation_duration(self, animation_duration: Duration) -> MaterialButton
Dart MaterialButton(animationDuration:).
Sourcepub fn material_tap_target_size(
self,
material_tap_target_size: MaterialTapTargetSize,
) -> MaterialButton
pub fn material_tap_target_size( self, material_tap_target_size: MaterialTapTargetSize, ) -> MaterialButton
Dart MaterialButton(materialTapTargetSize:).
Sourcepub fn min_width(self, min_width: f64) -> MaterialButton
pub fn min_width(self, min_width: f64) -> MaterialButton
Dart MaterialButton(minWidth:).
Sourcepub fn height(self, height: f64) -> MaterialButton
pub fn height(self, height: f64) -> MaterialButton
Dart MaterialButton(height:).
Sourcepub fn enable_feedback(self, enable_feedback: bool) -> MaterialButton
pub fn enable_feedback(self, enable_feedback: bool) -> MaterialButton
Dart MaterialButton(enableFeedback:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> MaterialButton
pub fn child<K>(self, child: impl IntoWidget<K>) -> MaterialButton
Dart MaterialButton(child:).
Trait Implementations§
Source§impl Debug for MaterialButton
impl Debug for MaterialButton
Source§impl StatelessWidget for MaterialButton
impl StatelessWidget for MaterialButton
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 build(&self, app: &mut App, context: BuildContext) -> WidgetRef
fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for MaterialButton
impl !Send for MaterialButton
impl !Sync for MaterialButton
impl !UnwindSafe for MaterialButton
impl Forget for MaterialButton
impl Freeze for MaterialButtonwhere
*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 MouseCursor> is !null: Freeze,
PhantomData<RcInner<dyn MouseCursor>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<dyn ShapeBorder> is !null: Freeze,
PhantomData<RcInner<dyn ShapeBorder>>: Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
impl Move for MaterialButton
impl Unpin for MaterialButton
impl UnsafeUnpin for MaterialButtonwhere
*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 MouseCursor> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn MouseCursor>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: 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<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.