show method

void show({
  1. required Widget child,
  2. Color? backgroundColor,
  3. Duration? duration,
  4. SnackBarAction? action,
  5. Animation<double>? animation,
  6. SnackBarBehavior? behavior,
  7. Key? key,
  8. double? elevation,
  9. double? width,
  10. EdgeInsetsGeometry? margin,
  11. EdgeInsetsGeometry? padding,
  12. dynamic onVisibile()?,
  13. ShapeBorder? shape,
})

Shows custom SnackBar

Implementation

void show({
  required Widget child,
  Color? backgroundColor,
  Duration? duration,
  SnackBarAction? action,
  Animation<double>? animation,
  SnackBarBehavior? behavior,
  Key? key,
  double? elevation,
  double? width,
  EdgeInsetsGeometry? margin,
  EdgeInsetsGeometry? padding,
  Function()? onVisibile,
  ShapeBorder? shape,
}) {
  var _snackBar = SnackBar(
    content: child,
    backgroundColor: backgroundColor,
    duration: duration ?? Duration(seconds: 3),
    action: action,
    animation: animation,
    behavior: behavior,
    elevation: elevation,
    key: key,
    margin: margin,
    onVisible: onVisibile,
    padding: padding,
    shape: shape,
    width: width,
  );
  hideCurrentSnackBar();
  rootScaffoldMessengerKey.currentState!.showSnackBar(_snackBar);
}