111
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
|
||||
/// Toast 工具类 - 提供统一的 toast 提示功能
|
||||
/// Toast 工具類 - 提供統一的 toast 提示功能
|
||||
///
|
||||
/// 使用 bot_toast 实现,确保 toast 显示在所有弹窗之上
|
||||
/// 使用 bot_toast 實現,確保 toast 顯示在所有彈窗之上
|
||||
class ToastUtils {
|
||||
ToastUtils._();
|
||||
|
||||
/// 显示普通提示
|
||||
/// 顯示普通提示
|
||||
static void show(String message, {Duration? duration}) {
|
||||
BotToast.showCustomText(
|
||||
toastBuilder: (_) => _buildToastWidget(message),
|
||||
@@ -18,7 +18,7 @@ class ToastUtils {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示成功提示
|
||||
/// 顯示成功提示
|
||||
static void showSuccess(String message, {Duration? duration}) {
|
||||
BotToast.showCustomText(
|
||||
toastBuilder: (_) => _buildToastWidget(
|
||||
@@ -32,7 +32,7 @@ class ToastUtils {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示错误提示
|
||||
/// 顯示錯誤提示
|
||||
static void showError(String message, {Duration? duration}) {
|
||||
BotToast.showCustomText(
|
||||
toastBuilder: (_) => _buildToastWidget(
|
||||
@@ -46,7 +46,7 @@ class ToastUtils {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示警告提示
|
||||
/// 顯示警告提示
|
||||
static void showWarning(String message, {Duration? duration}) {
|
||||
BotToast.showCustomText(
|
||||
toastBuilder: (_) => _buildToastWidget(
|
||||
@@ -60,7 +60,7 @@ class ToastUtils {
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建 toast widget
|
||||
/// 構建 toast widget
|
||||
static Widget _buildToastWidget(
|
||||
String message, {
|
||||
Color? backgroundColor,
|
||||
|
||||
Reference in New Issue
Block a user