1.现在.packages中增加包名:
oktoast:file:///C:/Users/Administrator/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/oktoast-2.1.4/lib/
2.包装 app widget
在main.dart中,必须使用OKToast包起来,
3.调用
- 如果只是Toast文字,可直接调用showToast函数,可通过设置position来设置Toast的位置
如:
showToast(menu, position:ToastPosition.bottom );
- 如果想要自定义Toast的样式,可调用showToastWidget函数,
注意:如果定义的页面涉及到Text,必须设置颜色,否则显示不出来