UToast class abstract

Snackbars, toasts and banners from anywhere, no BuildContext needed (uses navigatorKey). UToast.success(message: "Saved")

Constructors

UToast()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

theme → ThemeData
The theme used to color messages.
no setter

Static Methods

Material banner under the app bar that stays until dismissed or an action is tapped. UToast.banner(message: "You are offline", type: UToastType.warning)
clearSnackBars() → void
Removes every visible and queued snackbar.
clearToast() → void
Hides the current toast now.
dismissBanner() → void
Hides the current banner.
error({required String message, String? title, IconData? icon, Duration? duration, String? actionLabel, VoidCallback? onAction, bool showCloseIcon = false, VoidCallback? onDismiss}) → void
Red error snackbar. UToast.error(message: "Could not connect")
errorToast({required String message, String? title, IconData? icon, UToastPosition position = UToastPosition.bottom, Duration duration = const Duration(seconds: 3), VoidCallback? onTap, VoidCallback? onDismiss}) → void
Red floating toast.
info({required String message, String? title, IconData? icon, Duration? duration, String? actionLabel, VoidCallback? onAction, bool showCloseIcon = false, VoidCallback? onDismiss}) → void
Blue info snackbar. UToast.info(message: "New version available")
infoToast({required String message, String? title, IconData? icon, UToastPosition position = UToastPosition.bottom, Duration duration = const Duration(seconds: 3), VoidCallback? onTap, VoidCallback? onDismiss}) → void
Blue floating toast.
snackBar({required String message, String? title, UToastType type = UToastType.neutral, IconData? icon, Duration? duration, Color? backgroundColor, Color? foregroundColor, TextStyle? textStyle, SnackBarAction? action, String? actionLabel, VoidCallback? onAction, bool showCloseIcon = false, SnackBarBehavior? behavior, double? borderRadius, ShapeBorder? shape, double? elevation, DismissDirection dismissDirection = DismissDirection.down, EdgeInsetsGeometry? margin, double? width, bool clearQueue = false, VoidCallback? onDismiss}) → void
Material snackbar at the bottom with optional title, icon, action and close button. UToast.snackBar(message: "Deleted", actionLabel: "Undo", onAction: undo)
success({required String message, String? title, IconData? icon, Duration? duration, String? actionLabel, VoidCallback? onAction, bool showCloseIcon = false, VoidCallback? onDismiss}) → void
Green success snackbar. UToast.success(message: "Saved")
successToast({required String message, String? title, IconData? icon, UToastPosition position = UToastPosition.bottom, Duration? duration, VoidCallback? onTap, VoidCallback? onDismiss}) → void
Green floating toast. UToast.successToast(message: "Done")
toast({required String message, String? title, UToastType type = UToastType.neutral, IconData? icon, UToastPosition position = UToastPosition.bottom, Duration? duration, Duration animationDuration = const Duration(milliseconds: 600), Color? backgroundColor, Color? foregroundColor, EdgeInsets margin = const EdgeInsets.all(24), double borderRadius = 12, double elevation = 6, VoidCallback? onTap, VoidCallback? onDismiss}) → void
Floating pill message (top/center/bottom) that disappears by itself; works over dialogs too. UToast.toast(message: "Copied", position: UToastPosition.top)
warning({required String message, String? title, IconData? icon, Duration? duration, String? actionLabel, VoidCallback? onAction, bool showCloseIcon = false, VoidCallback? onDismiss}) → void
Orange warning snackbar. UToast.warning(message: "Check your input")
warningToast({required String message, String? title, IconData? icon, UToastPosition position = UToastPosition.bottom, Duration duration = const Duration(seconds: 3), VoidCallback? onTap, VoidCallback? onDismiss}) → void
Orange floating toast.