随笔分类 -  Flutter

摘要://通过ConstrainedBox来确保Stack占满屏幕 ConstrainedBox( constraints: BoxConstraints.expand(), child: Stack( alignment:Alignment.center , //指定未定位或部分定位widget的对齐方 阅读全文 »
posted @ 2022-06-08 17:52 macroK 阅读(116) 评论(0) 推荐(0) 编辑
摘要:KeepAliveWrapper 主要避免在切换Tab时,会刷新当前页面的所有状态,每个页面都会重新刷新 这里引入一个组件,能同时在列表中和列表外使用,并可以缓存它 class KeepAliveWrapper extends StatefulWidget { const KeepAliveWrap 阅读全文 »
posted @ 2022-04-30 17:01 macroK 阅读(447) 评论(0) 推荐(0) 编辑
摘要:shared_preferences 示例 static Future<void> setToken(String token) async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs. 阅读全文 »
posted @ 2022-04-28 16:38 macroK 阅读(185) 评论(0) 推荐(0) 编辑
摘要:库引用 pubspec.yaml 文件引入 dependencies: json_annotation: <最新版本> dev_dependencies: build_runner: <最新版本> json_serializable: <最新版本> 终端运行 flutter packages get 阅读全文 »
posted @ 2022-04-28 16:20 macroK 阅读(209) 评论(0) 推荐(0) 编辑
摘要:配置 final routes = { '/': (context, {arguments}) => Tabs(), ///需要传值路由 '/form': (context, {arguments}) => FormValuePage( arguments: arguments, ), '/prod 阅读全文 »
posted @ 2022-03-25 11:24 macroK 阅读(160) 评论(0) 推荐(0) 编辑
摘要:环境配置 Flutter SDK 安装 https://docs.flutter.dev/development/tools/sdk/releases?tab=macos 下载完成后解压将其SDK flutter文件夹放入系统根目录,例如: /Users/k/flutter_sdk/flutter 阅读全文 »
posted @ 2022-03-04 11:02 macroK 阅读(2547) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示