admin管理员组文章数量:1578025
1.Flutter 中界面绘制完成时的监听是通过WidgetBinding.instance.addPostFrameCallback((callback){
//这里面写监听界面的代码
})
2.flutter强制container撑满整个屏幕 width:double.infinity,
3.在setState时会报错:
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
内存泄露,调用setState的时候要在dispose()方法之前,如果执行完dispose()方法之后再调用setState()就会报这个错误。在调用之前做个判断就可以了。
if(mounted) {
setState(() {});
}
这是这个属性在State类中的注释:
/// It is an error to call [setState] unless [mounted] is true.
bool get mounted => _element != null;
4.在Dart中,没有基本数据类型,也就是没有默认值,或者说默认值都是null,一定记得在声明变量之后给这个变量赋上初始值,不然会在运行时报错。
5.Fultter 下拉刷新的控件
# https://github/peng8350/flutter_pulltorefresh
6.Flutter ViewPage控件 Swiper
# https://github/best-flutter/flutter_swiper
7.Flutter WebViewk控件 flutter_webview_plugin
#https://pub.dartlang/packages/flutter_webview_plugin
8.Flutter 联网控件
# https://github/flutterchina/dio
dio: ^1.0.13
9.Flutter插件网址:https://pub.dartlang/flutter
像获取设备信息,使用Toast, SQLite ,Sharedperferences都在这里面
10.咸鱼的简书网址:https://www.jianshu/u/cf5c0e4b1111
11.外加自己写的一个很烂的代码:https://github/qq245425070/flutter_wanandroid
版权声明:本文标题:关于Flutter的大杂烩 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1727248009a1104875.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论