show static method

void show(
  1. String title, {
  2. double bottom = 16,
  3. Duration duration = const Duration(seconds: 2),
  4. void onPressed()?,
  5. Offset? at,
})

Displays a FloatingSnackBar in a Overlay with the provided title.

Implementation

static void show(
  String title, {
  double bottom = 16,
  Duration duration = const Duration(seconds: 2),
  void Function()? onPressed,
  Offset? at,
}) {
  final style = Theme.of(router.context!).style;

  OverlayEntry? entry;

  entry = OverlayEntry(
    builder: (_) => FloatingSnackBar(
      duration: duration,
      onPressed: onPressed,
      onEnd: () {
        if (entry?.mounted == true) {
          entry?.remove();
        }
        entry = null;
      },
      bottom: bottom,
      at: at,
      child: Text(
        title,
        style: onPressed == null
            ? style.fonts.normal.regular.onBackground
            : style.fonts.medium.regular.primary,
      ),
    ),
  );

  router.overlay?.insert(entry!);
}