showOverlayNotification function

OverlaySupportEntry showOverlayNotification (
  1. WidgetBuilder builder,
  2. {Duration duration,
  3. Key key,
  4. NotificationPosition position: NotificationPosition.top}
)

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,
}) {
  if (duration == null) {
    duration = kNotificationDuration;
  }
  return showOverlay((context, t) {
    MainAxisAlignment 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);
}