SnackBar constructor Null safety
- {Key? key,
- required Widget content,
- Color? backgroundColor,
- double? elevation,
- EdgeInsetsGeometry? margin,
- EdgeInsetsGeometry? padding,
- double? width,
- ShapeBorder? shape,
- SnackBarBehavior? behavior,
- SnackBarAction? action,
- Duration duration = _snackBarDisplayDuration,
- Animation<
double> ? animation, - VoidCallback? onVisible,
- DismissDirection dismissDirection = DismissDirection.down,
- Clip clipBehavior = Clip.hardEdge}
Creates a snack bar.
The content argument must be non-null. The elevation must be null or non-negative.
Implementation
const SnackBar({
super.key,
required this.content,
this.backgroundColor,
this.elevation,
this.margin,
this.padding,
this.width,
this.shape,
this.behavior,
this.action,
this.duration = _snackBarDisplayDuration,
this.animation,
this.onVisible,
this.dismissDirection = DismissDirection.down,
this.clipBehavior = Clip.hardEdge,
}) : assert(elevation == null || elevation >= 0.0),
assert(content != null),
assert(
width == null || margin == null,
'Width and margin can not be used together',
),
assert(duration != null),
assert(clipBehavior != null);