showTopSnackBar function
void
showTopSnackBar({
- required BuildContext context,
- required SeniorNotificationSnackbar child,
- OverlayState? overlayState,
Implementation
void showTopSnackBar({
required BuildContext context,
required SeniorNotificationSnackbar child,
OverlayState? overlayState,
}) async {
overlayState ??= Overlay.of(context);
late OverlayEntry overlayEntry;
overlayEntry = OverlayEntry(
builder: (_) {
return _SeniorTopSnackbar(
child: child,
onDismissed: () {
overlayEntry.remove();
_previousEntry = null;
},
onTap: () {
child.seniorNotificationSnackBarAction?.onPressed?.call();
},
);
},
);
_previousEntry?.remove();
overlayState.insert(overlayEntry);
_previousEntry = overlayEntry;
}