snackBar static method
void
snackBar({
- Key? key,
- required Widget content,
- Color? backgroundColor,
- double? elevation,
- EdgeInsetsGeometry? margin,
- EdgeInsetsGeometry? padding,
- double? width,
- ShapeBorder? shape,
- SnackBarBehavior? behavior,
- SnackBarAction? action,
- Duration? duration,
- Animation<
double> ? animation, - VoidCallback? onVisible,
- DismissDirection dismissDirection = DismissDirection.down,
Display the SnackBar
Implementation
static void snackBar({
Key? key,
required Widget content,
Color? backgroundColor,
double? elevation,
EdgeInsetsGeometry? margin,
EdgeInsetsGeometry? padding,
double? width,
ShapeBorder? shape,
SnackBarBehavior? behavior,
SnackBarAction? action,
Duration? duration,
Animation<double>? animation,
VoidCallback? onVisible,
DismissDirection dismissDirection = DismissDirection.down,
}) {
final state = ScaffoldMessenger.maybeOf(context!);
state?.showSnackBar(
SnackBar(
key: key,
content: content,
backgroundColor: backgroundColor,
elevation: elevation,
margin: margin,
padding: padding,
width: width,
shape: shape,
behavior: behavior,
action: action,
duration: duration ?? const Duration(milliseconds: 4000),
animation: animation,
onVisible: onVisible,
dismissDirection: dismissDirection,
),
);
}