showToast static method

Future<void> showToast(
  1. String message, {
  2. Duration? duration,
  3. bool clickMaskDismiss = false,
  4. bool usePenetrate = true,
  5. Color maskColor = Colors.transparent,
  6. Alignment alignment = Alignment.center,
  7. SmartToastType displayType = SmartToastType.onlyRefresh,
})

showToast

Implementation

static Future<void> showToast(
  /// 显示内容
  String message, {

  /// 显示时长
  Duration? duration,

  /// 点击mask关闭
  bool clickMaskDismiss = false,

  /// 是否穿透点击
  bool usePenetrate = true,

  /// mask遮罩层颜色
  Color maskColor = Colors.transparent,

  /// 对其方式
  Alignment alignment = Alignment.center,

  /// 显示逻辑
  SmartToastType displayType = SmartToastType.onlyRefresh,
}) async {
  await SmartDialog.dismiss();
  SmartDialog.showToast(
    message,
    displayTime: duration,
    clickMaskDismiss: clickMaskDismiss,
    usePenetrate: usePenetrate,
    maskColor: maskColor,
    alignment: alignment,
    displayType: displayType,
    builder: (context) {
      return Container(
        padding: const EdgeInsets.all(16),
        decoration: const BoxDecoration(
          color: Colors.black,
          borderRadius: BorderRadius.all(Radius.circular(6)),
        ),
        child: Text(message, style: const TextStyle(color: Colors.white)),
      );
    },
  );
}