Toast class

Constructors

Toast.new()
factory

Properties

globalBuildToastQueueStyle BuildToastQueueStyle?
getter/setter pair
globalBuildToastStyle BuildToastStyle?
构建toast样式,外部自定义方式
getter/setter pair
globalPosition ToastPosition
显示位置
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
intervalTime int
两次toast的间隔时间
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showTime int
toast显示时间 单位 毫秒
getter/setter pair

Methods

initBaseStyle({EdgeInsetsGeometry? globalToastMargin, EdgeInsetsGeometry? globalToastPadding, AlignmentGeometry? globalToastAlignment, TextStyle? globalToastTextStyle, BoxDecoration? globalToastDecoration}) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

如果不关心,context调用,需在入口函数的 MaterialApp( navigatorKey: Toast.navigatorState ) 添加绑定 如果路由2.0 则使用 RouterDelegate 下面的 navigatorKey
final

Static Methods

cancel(OverlayEntryManger? manger) → void
cancelAll() → void
取消toast 显示
show(String msg, {BuildContext? context, BuildToastStyle? buildToastStyle, ToastPosition? position, int? showTime, BuildOverlayStyle? buildOverlayStyle, Color? backgroundColor = Colors.transparent}) Future<OverlayEntryManger?>
显示一个吐司
showCustomPoint({BuildContext? context, BuildToastStyle? buildToastStyle, required BuildToastPoint buildToastPoint, int? showTime}) Future<OverlayEntryManger?>
显示自定义坐标的吐司
showQueueToast(String msg, {bool status = true, BuildContext? context, BuildToastQueueStyle? buildStyle, Duration showTime = const Duration(milliseconds: 2000), Duration animationTime = const Duration(milliseconds: 600), Offset startOffset = const Offset(0, 0), Offset endOffset = const Offset(0, -100), ScalingFactor mobile = const ScalingFactor(0.7, 0.7), ScalingFactor tablet = const ScalingFactor(0.5, 0.7), ScalingFactor desktop = const ScalingFactor(0.3, 0.7), SizedBox divider = const SizedBox(height: 10)}) → void
支持队列的方式显示多个 toast 默认自下向上退出 显示的宽高受最大 ScalingFactor 缩放因子决定
showStatus(String msg, {bool status = true, BuildContext? context, double? width, double? height, double radius = 10, Color? bgColor = Colors.white, Color? toastBgColor = const Color(0x77000000), Color? iconColorSuccess = const Color(0xFF3EC3CF), Color? iconColorError = Colors.redAccent, double? iconSize = 26, TextStyle? textStyle = const TextStyle(color: Colors.black), int? showTime, EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 20, vertical: 10), EdgeInsetsGeometry margin = const EdgeInsets.symmetric(horizontal: 20, vertical: 10)}) → void
模板代码,外部可参考定制自己的各种状态样式