引入
fluttertoast: ^3.1.3
增加头文件
import 'package:fluttertoast/fluttertoast.dart';
样式
1
Fluttertoast.showToast( msg: "红色警告⚠️", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.CENTER, timeInSecForIos: 2, backgroundColor: Color(0xe74c3c), textColor: Color(0xffffff));
2
Fluttertoast.showToast( msg: "网络连接错误", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, timeInSecForIos: 2, backgroundColor: Color(0x9E9E9E), textColor: Color(0xffffff));