actionToast static method
void
actionToast(
- BuildContext context, {
- required String message,
- List<
ToastAction> ? actions, - Duration duration = const Duration(seconds: 3),
- Color background = const Color(0xFF2A3042),
Implementation
static void actionToast(
BuildContext context, {
required String message,
List<ToastAction>? actions, // 0 to 3 buttons supported
Duration duration = const Duration(seconds: 3),
Color background = const Color(0xFF2A3042),
}) {
final overlay = Overlay.of(context);
late OverlayEntry entry;
entry = OverlayEntry(
builder: (context) => _ToastWidget(
message: message,
background: background,
actions: actions ?? [],
onClose: () => entry.remove(),
),
);
overlay.insert(entry);
Future.delayed(duration, () {
if (entry.mounted) entry.remove();
});
}