提交 c20d5f8d authored 作者: shixiaochen's avatar shixiaochen

1、toast,设置显示时间

上级 eccd5572
......@@ -3,17 +3,28 @@ import 'package:flutter_clx_base/common/extension.dart';
import 'package:fluttertoast/fluttertoast.dart';
class ToastUtil {
static void showToast(String? txt,{Toast toastLength = Toast.LENGTH_SHORT}) {
if(txt.isNullOrEmpty()){
static void showToast(String? txt,
{ToastDuration toastLength = ToastDuration.short}) {
if (txt.isNullOrEmpty()) {
txt = "信息异常";
}
Fluttertoast.showToast(
msg: txt ?? "",
toastLength: toastLength,
toastLength: toastLength == ToastDuration.long
? Toast.LENGTH_LONG
: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
// timeInSecForIos: 1,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 16.0);
}
}
\ No newline at end of file
}
enum ToastDuration {
/// Show Short toast for 1 sec
short,
/// Show Long toast for 5 sec
long
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论