A new Flutter project.
`
|-- gen.sh # 脚本: 生成model、多语言、资源
|-- lib
| |-- main_dev.dart
| |-- main_prod.dart
| |-- app # 应用代码
| | |-- core
| | |-- data
| | |-- modules
| | |-- routes
| |-- config # 配置
| | |-- dev.dart
| | |-- prod.dart
| |-- constants # 常量
| | |-- app_values.dart
| |-- flavors
| | |-- build_config.dart
| | |-- env_config.dart
| | |-- environment.dart
| |-- generated # 脚手架自动生成资源、多语言
| |-- network # 通用网络库
|-- modules
| |-- common
`
flutter pub global activate get_cli
flutter pub global activate flutter_gen
Dev: flutter run --flavor dev lib/main_dev.dart
Prod: flutter run --flavor prod lib/main_prod.dart
flutter build apk -t lib/main_prod.dart --flavor prod
- 修改pubspec.yaml
- 执行
fluttergen -c pubspec.yaml
get create page:name
修改文件 assets/locales 生成 flutter pub run easy_localization:generate --source-dir assets/locales flutter pub run easy_localization:generate --source-dir assets/locales -f keys -o locale_keys.g.dart
- 资源位于
assets/locales
- 使用方法
tr(LocaleKeys.name)
flutter pub run build_runner build
执行 gen.sh