Files
ftng/CLAUDE.md
leon ac07f1f4c3 chore(deps): 更新项目依赖项
- 添加 audioplayers 音频播放功能库
- 添加 connectivity_plus 网络连接状态检测库
- 添加 floor SQLite 数据库 ORM 框架
- 添加 flutter_easyloading 加载提示组件
- 添加 get 状态管理框架
- 添加 shared_preferences 本地存储库
- 添加 sqflite SQLite 数据库操作库
- 更新相关依赖库到兼容版本
- 移除未使用的依赖项以优化项目结构
2026-03-31 14:25:28 +08:00

87 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 项目概述
ftng 是一个 Flutter 应用项目,使用 Dart SDK ^3.9.0。
## 常用命令
### 开发命令
```bash
# 获取依赖
flutter pub get
# 运行应用 (调试模式)
flutter run
# 热重载 (应用运行时按 r)
# 热重启 (应用运行时按 R)
# 构建应用
flutter build apk # Android APK
flutter build ios # iOS (需要 macOS)
flutter build web # Web 应用
```
### 测试与代码检查
```bash
# 运行所有测试
flutter test
# 运行单个测试文件
flutter test test/widget_test.dart
# 代码静态分析
flutter analyze
# 代码格式化
dart format .
```
### Floor 数据库代码生成
```bash
# 生成 Floor 数据库代码 (修改 entity/dao 后执行)
dart run build_runner build
# 清理并重新生成
dart run build_runner build --delete-conflicting-outputs
```
## 关键依赖
| 包名 | 用途 |
|------|------|
| get | 状态管理、路由、依赖注入 |
| floor + sqflite | SQLite 数据库 ORM |
| shared_preferences | 本地键值存储 |
| audioplayers | 音频播放 |
| connectivity_plus | 网络连接状态检测 |
| flutter_easyloading | 加载动画组件 |
| uuid | UUID 生成 |
## 项目结构约定
```
lib/
├── main.dart # 应用入口
├── app/ # GetX 应用配置 (bindings, routes)
├── controllers/ # GetX 控制器
├── views/ # 页面/视图
├── models/ # 数据模型
├── database/ # Floor 数据库配置
│ ├── entity/ # 数据库实体
│ ├── dao/ # 数据访问对象
│ └── database.dart # 数据库定义
├── services/ # 业务服务层
├── utils/ # 工具类
└── constants/ # 常量定义
```
## 代码规范
- 使用 GetX 进行状态管理 (`GetxController`)
- 数据库实体使用 `@entity` 注解DAO 使用 `@dao` 注解
- 路由使用 GetX 路由管理 (`GetPage`)
- 遵循 `flutter_lints` 代码规范