snackBar 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,
- Clip? clipBehavior,
Display the SnackBar
Implementation
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,
Clip? clipBehavior,
}) {
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 ?? DismissDirection.down,
clipBehavior: clipBehavior ?? Clip.hardEdge,
),
);
}