show static method
void
show(})
Implementation
static void show(
BuildContext context, {
required String message,
ToastType type = ToastType.info,
Duration duration = const Duration(seconds: 3),
Color? backgroundColor,
double borderRadius = 12,
IconData? icon,
bool fromBottom = false,
}) {
final overlay = Overlay.of(context);
late OverlayEntry overlayEntry;
overlayEntry = OverlayEntry(
builder: (context) => Positioned(
top: fromBottom ? null : MediaQuery.of(context).padding.top + 20,
bottom: fromBottom ? 50 : null,
left: 0,
right: 0,
child: _ToastWidget(
message: message,
type: type,
onDismiss: () => overlayEntry.remove(),
backgroundColor: backgroundColor,
borderRadius: borderRadius,
icon: icon,
),
),
);
overlay.insert(overlayEntry);
Future.delayed(duration, () => overlayEntry.remove());
}