随笔分类 -  flutter

Flutter异步Future
摘要:一、认识Future 1.创建Future 这里的执行结果是: Futue直接new就可以了。 我这里没有具体的返回数据,所以就用匿名函数代替了, Future future = new Future(() => null);相当于 Future<Null> future = new Future( 阅读全文
posted @ 2019-11-08 16:03 mingfeng002 阅读(365) 评论(0) 推荐(0)
flultter listview异常type '(BuildContext, int) => dynamic' is not a subtype of type '(BuildContext, int) => Widget'
摘要:type '(BuildContext, int) => dynamic' is not a subtype of type '(BuildContext, int) => Widget' 源码如下: 原因是因为_istviewItemBuilder没写 返回值类型Widget 加上就可以 阅读全文
posted @ 2019-09-26 16:48 mingfeng002 阅读(3530) 评论(0) 推荐(0)
flutter SnackBar异常Another exception was thrown: Scaffold.of() called with a context that does not contain a Scaffold
摘要:代码如下: 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决,代码如下: 阅读全文
posted @ 2019-09-26 15:45 mingfeng002 阅读(1857) 评论(0) 推荐(0)
flutter 处理dialog点击事件回调
摘要:flutter 处理dialog点击事件回调 阅读全文
posted @ 2019-09-25 18:51 mingfeng002 阅读(3567) 评论(0) 推荐(0)
flutter dialog异常Another exception was thrown: No MaterialLocalizations found
摘要:flutter dialog异常Another exception was thrown: No MaterialLocalizations found 这里顶层的context所在的Widget的顶层Widget属于StatefulWidget为什么还不能显示dialog呢 这里发现 这个Floa 阅读全文
posted @ 2019-09-25 17:30 mingfeng002 阅读(1718) 评论(0) 推荐(0)
flutter dialog异常Another exception was thrown: Navigator operation requested with a context that does not include a Navigator
摘要:我在使用flutter里的对话框控件的时候遇到了一个奇怪的错误 研究了一下才知道,flutter里的dialog不是随便就能用的。 原代码如下: 点击按钮的时候没有任何反应,控制台的报错是: 分析下源码吧~ 看showDialog方法的源码: Navigator.of 的源码: 找到了一模一样的错误 阅读全文
posted @ 2019-09-25 17:30 mingfeng002 阅读(1320) 评论(0) 推荐(0)