WToastConfig class

WToast 配置类,用于管理 WToast 的配置

使用示例:

// 创建配置实例并使用
final config = WToastConfig()
  ..theme = WToastTheme.dark;
config.showSuccess('操作成功');

// 使用自定义构建器
final customConfig = WToastConfig()
  ..successBuilder = (message, cancelFunc) => Container(
        padding: EdgeInsets.all(16),
        decoration: BoxDecoration(
          color: Colors.blue,
          borderRadius: BorderRadius.circular(8),
        ),
        child: Text(message, style: TextStyle(color: Colors.white)),
      );
customConfig.showSuccess('自定义成功提示');

// 配置加载提示
final loadingConfig = WToastConfig()
  ..loadingBuilder = (message, cancelFunc, dismissible) => GestureDetector(
        onTap: dismissible ? cancelFunc : null,
        child: Container(
          padding: EdgeInsets.all(16),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(8),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              CircularProgressIndicator(),
              Text(message),
            ],
          ),
        ),
      );

Constructors

WToastConfig()
私有构造函数

Properties

align Alignment?
对话框对齐方式
getter/setter pair
animationDuration Duration?
动画时长
getter/setter pair
backgroundColor Color?
对话框背景颜色
getter/setter pair
duration Duration?
对话框显示时长
getter/setter pair
errorBuilder Widget Function(Object? message, CancelFunc cancelFunc)?
自定义错误提示 Widget 构建回调
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
loadingBuilder Widget Function(Object? message, CancelFunc cancelFunc, bool dismissible)?
自定义加载提示 Widget 构建回调
getter/setter pair
onClose ↔ void Function()?
对话框关闭时的回调函数
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
successBuilder Widget Function(Object? message, CancelFunc cancelFunc)?
自定义成功提示 Widget 构建回调
getter/setter pair
theme WToastTheme
主题
getter/setter pair
toastBuilder Widget Function(CancelFunc cancelFunc)?
构建对话框内容的回调函数
getter/setter pair
warningBuilder Widget Function(Object? message, CancelFunc cancelFunc)?
自定义警告提示 Widget 构建回调
getter/setter pair

Methods

hideLoading() → void
关闭加载提示
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showError(Object? message, {Duration? duration, Alignment? align}) → CancelFunc
显示错误提示
showLoading({Object? message, bool dismissible = false}) → CancelFunc
显示加载提示
showSuccess(Object? message, {Duration? duration, Alignment? align}) → CancelFunc
显示成功提示
showWarning(Object? message, {Duration? duration, Alignment? align}) → CancelFunc
显示警告提示
toString() String
A string representation of this object.
inherited

Operators

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