ContextSnackBar extension
Provides convenient methods for showing snackbars.
- on
Methods
-
hideSnackBar(
) → void -
Available on BuildContext, provided by the ContextSnackBar extension
Hides the current snackbar. -
showError(
[String msg = 'Error']) → void -
Available on BuildContext, provided by the ContextSnackBar extension
Shows an error snackbar with a default message and colors. -
showSnackBar(
String msg, {Color? foreground, Color? background, SnackBarBehavior? behavior = SnackBarBehavior.floating, int durationMilliseconds = 2000, bool closeIcon = false, SnackBarAction? action, bool hideCurrent = true, TextStyle? textStyle, EdgeInsets? margin}) → void -
Available on BuildContext, provided by the ContextSnackBar extension
Shows a customizable snackbar.msg
is the text content of the snackbar.foreground
is the color of the text and close icon.background
is the background color of the snackbar.behavior
controls how the snackbar is displayed (floating or fixed). duration is the duration the snackbar is visible (in milliseconds).closeIcon
shows or hides the close icon.action
is an optional action button for the snackbar.hideCurrent
determines if the current snackbar should be hidden before showing a new one. -
showSuccess(
[String msg = 'Success']) → void -
Available on BuildContext, provided by the ContextSnackBar extension
Shows a success snackbar with a default message and colors.