-
安装配置好flutter环境
-
创建一个flutter计数器模板
-
flutter create nb_app
-
建立文件目录
-
安装 GetX 一个强大np的东西
-
flutter pub add get
-
安装 freezed 用于管理数据模型
-
flutter pub add freezed_annotation flutter pub add dev:build_runner flutter pub add dev:freezed # if using freezed to generate fromJson/toJson, also add: flutter pub add json_annotation flutter pub add dev:json_serializable
-
dart run build_runner build
- 安装一个 tabbar 组件按照例子配置
-
使用到本地图片时需要配置 pubspec.yaml
-
assets: - assets/images/
-
iconfont 官网建立项目找寻需要图标并下载
-
配置 pubspec.yaml
-
fonts: - family: IconFont fonts: - asset: assets/iconfont/iconfont.ttf
-
创建图标组件 lib/src/common/iconFont.dart
-
static const IconData tdxz = IconData( 0xe68c, fontFamily: 'IconFont', matchTextDirection: true, ); // tdxz 图标名字 => IconData.tdxz // 0xe68c 下载 iconfont.json 文件对应图标的 unicode => e68c => 0xe68c
-
// 使用 Icon( IconFont.tdxz, size: 20, color: const Color.fromRGBO(51, 51, 51, 1), ),
-
遇到一些看着很对的东西但报错 Invalid constant value. 时可能是组件内的值是一个动态的值 不能在使用 const .... 移除 widget 前面的 const 再试试
-
final error = Rxn<String>(); // Rxn<T> GetX工具,处理初始值可能为 null 的响应式数据 // 页面中可使用 Obx 监听 Rxn<T> 变化
-
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
-
Xcode => Runner => Build Setting => supported platforms
-
选择 IOS