MySnackBar constructor

const MySnackBar({
  1. Key? key,
  2. required Widget content,
  3. Color? backgroundColor,
  4. double? elevation,
  5. EdgeInsetsGeometry? margin,
  6. EdgeInsetsGeometry? padding,
  7. double? width,
  8. ShapeBorder? shape,
  9. SnackBarBehavior? behavior,
  10. SnackBarAction? action,
  11. Duration duration = _snackBarDisplayDuration,
  12. Animation<double>? animation,
  13. VoidCallback? onVisible,
  14. SnackPlacement? placement,
})

Creates a snack bar.

The content argument must be non-null. The elevation must be null or non-negative.

Implementation

const MySnackBar(
    {Key? 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.placement})
    : assert(elevation == null || elevation >= 0.0),
      assert(
        margin == null || behavior == SnackBarBehavior.floating,
        'Margin can only be used with floating behavior',
      ),
      assert(
        width == null || behavior == SnackBarBehavior.floating,
        'Width can only be used with floating behavior',
      ),
      assert(
        width == null || margin == null,
        'Width and margin can not be used together',
      ),
      assert(placement == null || behavior == SnackBarBehavior.floating,
          'Placement cant use with floating behavior'),
      super(key: key);