showToast function
void
showToast(
- BuildContext context,
- String label,
- String message,
- Duration duration,
- S360fToastType type, {
- S360fToastPosition position = S360fToastPosition.topRight,
Implementation
void showToast(
BuildContext context,
String label,
String message,
Duration duration,
S360fToastType type, {
S360fToastPosition position = S360fToastPosition.topRight,
}) {
late OverlayEntry overlayEntry;
final toastPosition = getToastPosition(position);
final size = MediaQuery.of(context).size;
overlayEntry = OverlayEntry(
builder: (BuildContext context) => Positioned(
top: toastPosition.top,
bottom: toastPosition.bottom,
left: toastPosition.left,
right: toastPosition.right,
width: size.width * 0.75,
child: Align(
alignment: toastPosition.alignment,
child: S360fToast(
label: label,
position: position,
message: message,
duration: duration,
type: type,
onDismissed: () {
overlayEntry.remove();
},
),
),
),
);
Overlay.of(context).insert(overlayEntry);
}