showWithNavigatorState method
- @Deprecated('use show or showCustom method instead, and you can pass the OverlayState as a parameter')
using this method you can show a notification by using the navigator overlay
you should create your own widget and pass it to the builder parameter
the return value is a ToastificationItem that you can use to dismiss the notification
or find the notification details by its id
toastification.showWithNavigatorState(
navigator: navigatorState or Navigator.of(context),
alignment: Alignment.topRight,
animationDuration: Duration(milliseconds: 500),
autoCloseDuration: Duration(seconds: 3),
builder: (context, item) {
return CustomToastWidget();
},
);
Implementation
@Deprecated(
'use show or showCustom method instead, and you can pass the OverlayState as a parameter')
/// using this method you can show a notification by using the [navigator] overlay
/// you should create your own widget and pass it to the [builder] parameter
///
///
/// the return value is a [ToastificationItem] that you can use to dismiss the notification
/// or find the notification details by its [id]
///
/// ```dart
/// toastification.showWithNavigatorState(
/// navigator: navigatorState or Navigator.of(context),
/// alignment: Alignment.topRight,
/// animationDuration: Duration(milliseconds: 500),
/// autoCloseDuration: Duration(seconds: 3),
/// builder: (context, item) {
/// return CustomToastWidget();
/// },
/// );
/// ```
ToastificationItem showWithNavigatorState({
required NavigatorState navigator,
required ToastificationBuilder builder,
AlignmentGeometry? alignment,
TextDirection? textDirection,
ToastificationAnimationBuilder? animationBuilder,
Duration? animationDuration,
Duration? autoCloseDuration,
ToastificationCallbacks callbacks = const ToastificationCallbacks(),
}) {
final context = navigator.context;
return showCustom(
context: context,
alignment: alignment,
direction: textDirection,
builder: builder,
animationBuilder: animationBuilder,
animationDuration: animationDuration,
autoCloseDuration: autoCloseDuration,
overlayState: navigator.overlay,
callbacks: callbacks,
);
}