show static method

Future<void> show(
  1. BuildContext context,
  2. String message, {
  3. String? actionLabel,
  4. VoidCallback? onAction,
  5. Duration duration = const Duration(seconds: 3),
})

Show a snackbar using Overlay and automatically dismiss it after duration.

Implementation

static Future<void> show(
  BuildContext context,
  String message, {
  String? actionLabel,
  VoidCallback? onAction,
  Duration duration = const Duration(seconds: 3),
}) async {
  final OverlayState overlay = Overlay.of(context);

  final MiniTheme theme = MiniThemeProvider.of(context);

  await miniShowOverlayEntry(
    overlay: overlay,
    duration: duration,
    builder: (BuildContext overlayContext) {
      return Positioned(
        left: theme.spacing.lg,
        right: theme.spacing.lg,
        bottom: theme.spacing.lg,
        child: MiniSnackbar(
          message: message,
          actionLabel: actionLabel,
          onAction: onAction,
        ),
      );
    },
  );
}