Snackbar
A brief notification bar that appears temporarily at the bottom of the screen. Supports an optional action button that the user can tap. After Duration seconds the snackbar hides itself and invokes OnDismiss so the caller can remove it from the tree.
Constructor
Snackbar
Creates a Snackbar element.
| Parameter | Description |
|---|---|
message | The notification text. Must not be null. |
actionLabel | Label for the optional action button. |
onAction | Callback invoked when the action button is tapped. |
duration | Visible duration in seconds. Defaults to 4. |
onDismiss | Callback invoked after auto-dismiss. Use to remove the snackbar from the tree. |
key | An optional key for reconciliation identity. |
Properties
ActionLabel
The label for the optional action button. Null means no action button is shown.
Duration
How long the snackbar remains visible, in seconds. Defaults to 4 seconds.
Message
The message text displayed in the snackbar.
OnAction
Callback invoked when the user taps the action button. Only relevant when ActionLabel is non-null.
OnDismiss
Callback invoked after the snackbar auto-dismisses. Use this to remove the snackbar from the tree. Optional — the snackbar hides itself regardless.
Methods
CreateState
Last updated on