pub struct SnackBarAction {
pub key: Option<KeyRef>,
pub text_color: Option<AnyColor>,
pub background_color: Option<AnyColor>,
pub disabled_text_color: Option<Color>,
pub disabled_background_color: Option<Color>,
pub label: String,
pub on_pressed: VoidCallback,
}Expand description
A button for a SnackBar, known as an “action”.
Snack bar actions are always enabled. Instead of disabling a snack bar action, avoid including it in the snack bar in the first place.
Snack bar actions can only be pressed once. Subsequent presses are ignored.
See also:
Fields§
§key: Option<KeyRef>§text_color: Option<AnyColor>The button label color. If not provided, defaults to
SnackBarThemeData::action_text_color.
If text_color is a WidgetStateColor, then the text color
will be resolved against the set of WidgetStates that the action text
is in, thus allowing for different colors for states such as pressed,
hovered and others.
background_color: Option<AnyColor>The button background fill color. If not provided, defaults to
SnackBarThemeData::action_background_color.
If background_color is a WidgetStateColor, then the
text color will be resolved against the set of WidgetStates that the action text
is in, thus allowing for different colors for the states.
disabled_text_color: Option<Color>The button disabled label color. This color is shown after the
SnackBarAction is dismissed.
disabled_background_color: Option<Color>The button disabled background color. This color is shown after the
SnackBarAction is dismissed.
If not provided, defaults to SnackBarThemeData::disabled_action_background_color.
label: StringThe button label.
on_pressed: VoidCallbackThe callback to be called when the button is pressed.
This callback will be called at most once each time this action is
displayed in a SnackBar.
Implementations§
Source§impl SnackBarAction
impl SnackBarAction
Sourcepub fn new(
label: impl Into<String>,
on_pressed: impl Fn(&mut App) + 'static,
) -> SnackBarAction
pub fn new( label: impl Into<String>, on_pressed: impl Fn(&mut App) + 'static, ) -> SnackBarAction
Creates an action for a SnackBar; Dart’s optional arguments are the setters.
Sourcepub fn key(self, key: KeyRef) -> SnackBarAction
pub fn key(self, key: KeyRef) -> SnackBarAction
Dart SnackBarAction(key:).
Sourcepub fn text_color(self, text_color: impl Into<AnyColor>) -> SnackBarAction
pub fn text_color(self, text_color: impl Into<AnyColor>) -> SnackBarAction
Dart SnackBarAction(textColor:).
Sourcepub fn disabled_text_color(self, disabled_text_color: Color) -> SnackBarAction
pub fn disabled_text_color(self, disabled_text_color: Color) -> SnackBarAction
Dart SnackBarAction(disabledTextColor:).
Sourcepub fn background_color(
self,
background_color: impl Into<AnyColor>,
) -> SnackBarAction
pub fn background_color( self, background_color: impl Into<AnyColor>, ) -> SnackBarAction
Dart SnackBarAction(backgroundColor:).
Sourcepub fn disabled_background_color(
self,
disabled_background_color: Color,
) -> SnackBarAction
pub fn disabled_background_color( self, disabled_background_color: Color, ) -> SnackBarAction
Dart SnackBarAction(disabledBackgroundColor:).
Trait Implementations§
Source§impl Clone for SnackBarAction
impl Clone for SnackBarAction
Source§impl Debug for SnackBarAction
impl Debug for SnackBarAction
Source§impl StatefulWidget for SnackBarAction
impl StatefulWidget for SnackBarAction
Source§type State = SnackBarActionState
type State = SnackBarActionState
Source§fn create_state(&self) -> SnackBarActionState
fn create_state(&self) -> SnackBarActionState
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 + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
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 SnackBarAction
impl !Send for SnackBarAction
impl !Sync for SnackBarAction
impl !UnwindSafe for SnackBarAction
impl Forget for SnackBarAction
impl Freeze for SnackBarActionwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
&'static dyn ColorExtension: Freeze,
*const RcInner<dyn ColorExtension> is !null: Freeze,
PhantomData<RcInner<dyn ColorExtension>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
impl Move for SnackBarAction
impl Unpin for SnackBarAction
impl UnsafeUnpin for SnackBarActionwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
&'static dyn ColorExtension: UnsafeUnpin,
*const RcInner<dyn ColorExtension> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ColorExtension>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.