showOverlayNotification function
OverlaySupportEntry
showOverlayNotification(
- WidgetBuilder builder, {
- Duration? duration,
- Key? key,
- NotificationPosition position = NotificationPosition.top,
- BuildContext? context,
Popup a notification at the top of screen.
duration
the notification display duration , overlay will auto dismiss after duration
.
if null , will be set to kNotificationDuration.
if zero , will not auto dismiss in the future.
position
the position of notification, default is NotificationPosition.top,
can be NotificationPosition.top or NotificationPosition.bottom.
Implementation
OverlaySupportEntry showOverlayNotification(
WidgetBuilder builder, {
Duration? duration,
Key? key,
NotificationPosition position = NotificationPosition.top,
BuildContext? context,
}) {
duration ??= kNotificationDuration;
return showOverlay(
(context, t) {
var alignment = MainAxisAlignment.start;
if (position == NotificationPosition.bottom) {
alignment = MainAxisAlignment.end;
}
return Column(
mainAxisAlignment: alignment,
children: <Widget>[
position == NotificationPosition.top
? TopSlideNotification(builder: builder, progress: t)
: BottomSlideNotification(builder: builder, progress: t)
],
);
},
duration: duration,
key: key,
context: context,
);
}