alerts/ny_alerts library
Classes
- DefaultToastNotification
- DefaultToastNotification a simple toast notification. This is the fallback widget used when no custom toast styles are registered.
- ToastAnimation
- ToastAnimation defines animation styles for toast notifications. Use factory constructors to create different animation effects.
- ToastMeta
- Toast Meta makes it easy to use pre-defined styles in the toast alert.
- ToastNotificationRegistry
- Registry for toast notification styles. Stores widget factories keyed by string IDs (e.g., "success", "warning"). Use ToastNotificationRegistry.register to add custom toast styles.
Enums
- ToastAnimationType
- Animation type for toast notifications.
- ToastNotificationPosition
- Position where the toast notification appears.
Functions
-
showToastNotification(
BuildContext context, {String id = 'success', String? title, String? description, Map< String, dynamic> ? data, Duration? duration, ToastNotificationPosition? position, ToastAnimation? animation, VoidCallback? action, VoidCallback? onDismiss, VoidCallback? onShow}) → void -
Display a new Toast notification to the user.
Provide a valid toast
id(e.g., "success", "warning", "info", "danger") or a custom ID registered via Nylo.addToastNotifications. Set atitleanddescriptionto personalize the message.
Typedefs
- ToastOnInitStateCallback = dynamic Function(Duration toastDuration, Duration animDuration)
-
Callback for the toast widget's
initStatelifecycle hook. Receives the toast displaydurationand animationanimDuration. -
ToastStyleDataFactory
= ToastStyleFactory Function(Map<
String, dynamic> data) -
Typedef for a data-aware toast style factory.
Receives a
datamap and returns a ToastStyleFactory. This allows toast styles to use dynamic data passed at call time. - ToastStyleFactory = Widget Function(ToastMeta meta, void updateMeta(ToastMeta))
-
Typedef for toast style factory function.
The factory receives the ToastMeta and an
updateMetacallback to allow the widget to update position, duration, etc.