showToast static method
void
showToast(
- String message, {
- BuildContext? context,
- ToastType type = ToastType.info,
- ToastPosition position = ToastPosition.top,
- Duration duration = const Duration(seconds: 2),
- String? title,
- bool showCloseIcon = true,
- ToastAnimation animation = ToastAnimation.none,
- TextStyle? messageStyle,
- TextStyle? titleStyle,
- EdgeInsetsGeometry? padding,
- double borderRadius = 8.0,
- double elevation = 0.0,
- Widget? icon,
- Color? backgroundColor,
- VoidCallback? onTap,
- double? progress,
- bool showIndicator = false,
====================================================== SHOW TOAST
Example:
TfkToast.showToast(
"Order placed successfully",
type: ToastType.success,
);
======================================================
Implementation
static void showToast(
String message, {
BuildContext? context,
ToastType type = ToastType.info,
ToastPosition position = ToastPosition.top,
Duration duration = const Duration(seconds: 2),
String? title,
bool showCloseIcon = true,
ToastAnimation animation = ToastAnimation.none,
TextStyle? messageStyle,
TextStyle? titleStyle,
EdgeInsetsGeometry? padding,
double borderRadius = 8.0,
double elevation = 0.0,
Widget? icon,
Color? backgroundColor,
VoidCallback? onTap,
double? progress,
bool showIndicator = false,
}) {
_toastQueue.add(
ToastEntry(
message: message,
type: type,
position: position,
duration: duration,
title: title,
showCloseIcon: showCloseIcon,
animation: animation,
messageStyle: messageStyle,
titleStyle: titleStyle,
padding: padding,
borderRadius: borderRadius,
elevation: elevation,
icon: icon,
backgroundColor: backgroundColor,
onTap: onTap,
progress: progress,
showIndicator: showIndicator,
),
);
if (!_isToastActive) {
_showNextToast(context);
}
}