SnackBarClosedReason enum
Specify how a SnackBar was closed.
The ScaffoldMessengerState.showSnackBar function returns a ScaffoldFeatureController. The value of the controller's closed property is a Future that resolves to a SnackBarClosedReason. Applications that need to know how a snackbar was closed can use this value.
Example:
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('He likes me. I think he likes me.'),
)
).closed.then((SnackBarClosedReason reason) {
// ...
});
Values
- action → const SnackBarClosedReason
-
The snack bar was closed after the user tapped a SnackBarAction.
- dismiss → const SnackBarClosedReason
-
The snack bar was closed through a SemanticsAction.dismiss.
- swipe → const SnackBarClosedReason
-
The snack bar was closed by a user's swipe.
- hide → const SnackBarClosedReason
-
The snack bar was closed by the ScaffoldFeatureController close callback or by calling ScaffoldMessengerState.hideCurrentSnackBar directly.
- remove → const SnackBarClosedReason
-
The snack bar was closed by an call to ScaffoldMessengerState.removeCurrentSnackBar.
- timeout → const SnackBarClosedReason
-
The snack bar was closed because its timer expired.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
SnackBarClosedReason> - A constant List of the values in this enum, in order of their declaration.