show static method
void
show(
- BuildContext context, {
- required String message,
- SubZeroToastType type = SubZeroToastType.defaultType,
- SubZeroToastPosition position = SubZeroToastPosition.bottom,
- SubZeroToastActionMode actionMode = SubZeroToastActionMode.icon,
- Duration duration = const Duration(seconds: 4),
- String? actionLabel,
- VoidCallback? onAction,
- IconData? leadingIcon,
- bool showCloseButton = true,
- double? maxWidth,
Shows a toast with full configuration
Implementation
static void show(
BuildContext context, {
required String message,
SubZeroToastType type = SubZeroToastType.defaultType,
SubZeroToastPosition position = SubZeroToastPosition.bottom,
SubZeroToastActionMode actionMode = SubZeroToastActionMode.icon,
Duration duration = const Duration(seconds: 4),
String? actionLabel,
VoidCallback? onAction,
IconData? leadingIcon,
bool showCloseButton = true,
double? maxWidth,
}) {
_dismiss();
final config = SubZeroToastConfig(
message: message,
type: type,
position: position,
actionMode: actionMode,
duration: duration,
actionLabel: actionLabel,
onAction: onAction,
leadingIcon: leadingIcon,
showCloseButton: showCloseButton,
maxWidth: maxWidth,
);
final overlay = Overlay.of(context);
_currentOverlay = OverlayEntry(
builder: (context) => _SubZeroToastOverlay(
config: config,
onDismiss: _dismiss,
),
);
overlay.insert(_currentOverlay!);
_dismissTimer = Timer(duration, _dismiss);
}