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

1、toast,设置显示时间

上级 17be4729
...@@ -3,13 +3,13 @@ import 'package:flutter_clx_base/common/extension.dart'; ...@@ -3,13 +3,13 @@ import 'package:flutter_clx_base/common/extension.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
class ToastUtil { class ToastUtil {
static void showToast(String? txt) { static void showToast(String? txt,{Toast toastLength = Toast.LENGTH_SHORT}) {
if(txt.isNullOrEmpty()){ if(txt.isNullOrEmpty()){
txt = "信息异常"; txt = "信息异常";
} }
Fluttertoast.showToast( Fluttertoast.showToast(
msg: txt ?? "", msg: txt ?? "",
toastLength: Toast.LENGTH_SHORT, toastLength: toastLength,
gravity: ToastGravity.BOTTOM, gravity: ToastGravity.BOTTOM,
// timeInSecForIos: 1, // timeInSecForIos: 1,
backgroundColor: Colors.grey, backgroundColor: Colors.grey,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论