showToast static method
- String msg, {
- bool? clickBgDismissTemp,
- bool? isLoadingTemp,
- bool? isPenetrateTemp,
- bool? isUseAnimationTemp,
- Duration? animationDurationTemp,
- Color? maskColorTemp,
- Widget? maskWidgetTemp,
- AlignmentGeometry alignment = Alignment.bottomCenter,
- bool? consumeEvent,
- Duration? time,
- bool? debounceTemp,
- SmartToastType? type,
- Widget? widget,
toast message: param with a suffix of 'temp', indicating that such params can be set to default values in Config
msg
:msg presented to users(Use the 'widget' param, this param will be invalid)
clickBgDismissTemp
:default(false),true(loading will be closed after click background),
false(not close)
isLoadingTemp
:default(true),true(use the opacity animation),
false(use the scale transition animation)
isPenetrateTemp
:default(true),true(the click event will penetrate background),
false(not penetration)
isUseAnimationTemp
:true(use the animation),false(not use)
animationDurationTemp
:animation duration
maskColorTemp
:the color of the mask,it is invalid if maskWidgetTemp
set the value
maskWidgetTemp
:highly customizable mask
alignment
:control the location of toast on the screen
consumeEvent
: default (false), true (toast will consume touch events),
false (toast no longer consumes events, touch events can penetrate toast)
time
:toast display time on the screen(Use the 'widget' param, this param will be invalid)
debounceTemp
:debounce feature
type
:provider multiple display logic,
please refer to SmartToastType comment for detailed description
widget
:highly customizable toast
toast消息:以 'temp' 后缀的参数,表示此类参数都可在Config
中设置默认值
msg
:呈现给用户的信息(使用 'widget' 参数,该参数将失效)
clickBgDismissTemp
:默认(false),true(点击半透明的暗色背景后,将关闭loading),false(不关闭)
isLoadingTemp
:默认(true),true(使用透明动画),false(使用尺寸缩放动画)
isPenetrateTemp
:默认(true),true(点击事件将穿透背景),false(不穿透)
isUseAnimationTemp
:true(使用动画),false(不使用)
animationDurationTemp
:动画持续时间
maskColorTemp
:遮罩颜色,如果给maskWidgetTemp
设置了值,该参数将会失效
maskWidgetTemp
:可高度定制遮罩
alignment
:控制toast在屏幕上的显示位置(使用 'widget' 参数,该参数将失效)
consumeEvent
:默认(false),true(toast会消耗触摸事件),false(toast不再消耗事件,触摸事件能穿透toast)
time
:toast在屏幕上的显示时间
debounceTemp
:防抖功能(debounce)
type
:提供多种显示逻辑,详细描述请查看 SmartToastType 注释
widget
:可高度定制化toast
Implementation
static Future<void> showToast(
String msg, {
bool? clickBgDismissTemp,
bool? isLoadingTemp,
bool? isPenetrateTemp,
bool? isUseAnimationTemp,
Duration? animationDurationTemp,
Color? maskColorTemp,
Widget? maskWidgetTemp,
AlignmentGeometry alignment = Alignment.bottomCenter,
bool? consumeEvent,
Duration? time,
bool? debounceTemp,
SmartToastType? type,
Widget? widget,
}) async {
return DialogProxy.instance.showToast(
clickBgDismiss: clickBgDismissTemp ?? false,
isLoading: isLoadingTemp ?? true,
isPenetrate: isPenetrateTemp ?? true,
isUseAnimation: isUseAnimationTemp ?? true,
animationDuration: animationDurationTemp ?? Duration(milliseconds: 200),
maskColor: maskColorTemp ?? config.maskColor,
maskWidget: maskWidgetTemp ?? config.maskWidget,
consumeEvent: consumeEvent ?? false,
time: time ?? Duration(milliseconds: 2000),
debounce: debounceTemp ?? config.debounce,
type: type ?? SmartToastType.normal,
widget: widget ?? DialogProxy.instance.toastBuilder(msg, alignment),
);
}