showToast static method
OverlayShower
showToast(
- String text, {
- String? key,
- bool isStateful = false,
- BoxShadow? shadow,
- EdgeInsets? padding,
- TextStyle? textStyle,
- BorderRadius? radius,
- Decoration? decoration,
- Color? backgroundColor,
- void onWidgetBuild(
- Widget widget
- Curve? curve,
- Duration? appearDuration,
- Duration? dismissDuration,
- Duration? onScreenDuration,
- Offset? slideBegin,
- double? opacityBegin,
- Widget appearAnimatedBuilder(
- OverlayShower shower,
- AnimationController controller,
- Widget widget
- Widget dismissAnimatedBuilder(
- OverlayShower shower,
- AnimationController controller,
- Widget widget
Toast
Implementation
static OverlayShower showToast(
String text, {
String? key,
bool isStateful = false,
// widget properties
BoxShadow? shadow,
EdgeInsets? padding,
TextStyle? textStyle,
BorderRadius? radius,
Decoration? decoration,
Color? backgroundColor,
void Function(Widget widget)? onWidgetBuild,
// animation properties
Curve? curve,
Duration? appearDuration,
Duration? dismissDuration,
Duration? onScreenDuration, // if set to Duration.zero, should dismiss manually
// animation settings
Offset? slideBegin,
double? opacityBegin,
Widget Function(OverlayShower shower, AnimationController controller, Widget widget)? appearAnimatedBuilder,
Widget Function(OverlayShower shower, AnimationController controller, Widget widget)? dismissAnimatedBuilder,
}) {
Widget widget = isStateful ? AnyToastWidget(text: text) : AnyToastView(text: text);
(widget as AnyToastWidgetProperties)
..radius = radius
..shadow = shadow
..padding = padding
..textStyle = textStyle
..decoration = decoration
..backgroundColor = backgroundColor;
onWidgetBuild?.call(widget);
return show(
key: key,
child: widget,
curve: curve,
appearDuration: appearDuration,
dismissDuration: dismissDuration,
onScreenDuration: onScreenDuration,
slideBegin: slideBegin,
opacityBegin: opacityBegin,
appearAnimatedBuilder: appearAnimatedBuilder,
dismissAnimatedBuilder: dismissAnimatedBuilder,
);
}