官方文档地址:https://www.kikt.top/posts/flutter/toast/oktoast/
pub地址:https://pub.flutter-io.cn/packages/oktoast
yaml文件里面加入:
oktoast: ^2.3.2
下面是简单用法
import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
class ToastUtil{
static show(text){
showToast(text);
}
static _showCustomWidgetToast() {
var w = Center(
child: Container(
padding: const EdgeInsets.all(10),
color: Colors.black.withOpacity(0.7),
child: Row(
children: <Widget>[
Icon(
Icons.add,
color: Colors.white,
),
Text(
'添加成功',
style: TextStyle(color: Colors.white),
),
],
mainAxisSize: MainAxisSize.min,
),
),
);
showToastWidget(w);
}
}