158 lines
5.6 KiB
Markdown
158 lines
5.6 KiB
Markdown
|
|
# Monisuo 主题现代化实施计划
|
|||
|
|
|
|||
|
|
## Status
|
|||
|
|
STATUS: COMPLETE
|
|||
|
|
|
|||
|
|
## Progress
|
|||
|
|
|
|||
|
|
### Phase 1: Analysis ✅
|
|||
|
|
|
|||
|
|
#### 已完成的 shadcn 集成
|
|||
|
|
- ✅ main.dart 已更新为 ShadApp.custom
|
|||
|
|
- ✅ 主题配置完成(Slate 深色模式)
|
|||
|
|
- ✅ 依赖安装完成(shadcn_ui 0.52.1, lucide_icons_flutter)
|
|||
|
|
|
|||
|
|
#### 页面重构状态
|
|||
|
|
| 页面 | 状态 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| main_page.dart | ✅ 完成 | 使用 ShadTheme, LucideIcons, 底部导航 |
|
|||
|
|
| login_page.dart | ✅ 完成 | 使用 ShadForm, ShadInputFormField, ShadButton, ShadDialog |
|
|||
|
|
| home_page.dart | ✅ 完成 | 使用 ShadTheme, LucideIcons, ShadCard, CircleAvatar |
|
|||
|
|
| market_page.dart | ✅ 完成 | 使用 ShadInput, ShadCard, CircleAvatar |
|
|||
|
|
| trade_page.dart | ✅ 完成 | 使用 ShadInputFormField, ShadButton, ShadCard |
|
|||
|
|
| asset_page.dart | ✅ 完成 | 使用 ShadTheme, LucideIcons, ShadCard, CircleAvatar |
|
|||
|
|
| mine_page.dart | ✅ 完成 | 使用 ShadTheme, LucideIcons, ShadButton.destructive |
|
|||
|
|
|
|||
|
|
### Phase 2: Core Pages (P0) ✅
|
|||
|
|
|
|||
|
|
#### 2.1 main_page.dart 替换 ✅
|
|||
|
|
- ✅ 删除原 main_page.dart
|
|||
|
|
- ✅ 重命名 main_page_shadcn.dart 为 main_page.dart
|
|||
|
|
- ✅ 修复 LucideIcons.home -> LucideIcons.house
|
|||
|
|
|
|||
|
|
#### 2.2 login_page.dart 替换 ✅
|
|||
|
|
- ✅ 删除原 login_page.dart
|
|||
|
|
- ✅ 重命名 login_page_shadcn.dart 为 login_page.dart
|
|||
|
|
- ✅ 修复导入路径问题
|
|||
|
|
|
|||
|
|
#### 2.3 home_page.dart 重构 ✅
|
|||
|
|
- ✅ 使用 ShadTheme 替换 AppColors
|
|||
|
|
- ✅ 使用 LucideIcons 替换 Material Icons
|
|||
|
|
- ✅ 使用 ShadCard 替换 Container + BoxDecoration
|
|||
|
|
- ✅ 使用 CircleAvatar 替换 ShadAvatar
|
|||
|
|
- ✅ 使用 ShadDialog 替换 AlertDialog
|
|||
|
|
|
|||
|
|
### Phase 3: Feature Pages (P1) ✅
|
|||
|
|
|
|||
|
|
#### 3.1 market_page.dart 重构 ✅
|
|||
|
|
- ✅ 使用 ShadInput 替换 TextField(搜索框)
|
|||
|
|
- ✅ 使用 ShadCard 替换 Container(币种列表)
|
|||
|
|
- ✅ 使用 CircleAvatar 替换 ShadAvatar
|
|||
|
|
- ✅ 使用 LucideIcons 替换 Material Icons
|
|||
|
|
|
|||
|
|
#### 3.2 trade_page.dart 重构 ✅
|
|||
|
|
- ✅ 使用 ShadInputFormField 替换 TextField
|
|||
|
|
- ✅ 使用 ShadButton 替换渐变按钮
|
|||
|
|
- ✅ 使用 ShadCard 替换 Container
|
|||
|
|
- ✅ 使用 LucideIcons 替换 Material Icons
|
|||
|
|
|
|||
|
|
#### 3.3 asset_page.dart 重构 ✅
|
|||
|
|
- ✅ 使用 ShadCard 替换 Container
|
|||
|
|
- ✅ 使用 ShadButton 替换 ElevatedButton
|
|||
|
|
- ✅ 使用 ShadDialog 替换 AlertDialog
|
|||
|
|
- ✅ 使用 CircleAvatar 替换 ShadAvatar
|
|||
|
|
- ✅ 使用 LucideIcons 替换 Material Icons
|
|||
|
|
|
|||
|
|
#### 3.4 mine_page.dart 重构 ✅
|
|||
|
|
- ✅ 使用 ShadCard 替换 Container
|
|||
|
|
- ✅ 使用 ShadButton.destructive 替换退出登录按钮
|
|||
|
|
- ✅ 使用 LucideIcons 替换 Material Icons
|
|||
|
|
- ✅ 使用 CircleAvatar 替换 ShadAvatar
|
|||
|
|
|
|||
|
|
### Phase 4: Custom Components (P2) ✅
|
|||
|
|
|
|||
|
|
已创建的自定义组件:
|
|||
|
|
- ✅ `lib/ui/components/coin_card.dart` - 币种卡片组件
|
|||
|
|
- ✅ `lib/ui/components/trade_button.dart` - 交易按钮组件(买入/卖出)
|
|||
|
|
- ✅ `lib/ui/components/asset_card.dart` - 资产卡片组件(带渐变背景)
|
|||
|
|
- ✅ `lib/ui/components/components.dart` - 组件导出文件
|
|||
|
|
|
|||
|
|
### Phase 5: Animation Enhancement (P3)
|
|||
|
|
- ⏸️ 暂未添加(flutter_animate 已在 shadcn_ui 中集成)
|
|||
|
|
|
|||
|
|
## Changes Made
|
|||
|
|
|
|||
|
|
### 页面修改
|
|||
|
|
1. **main_page.dart** - 替换为 shadcn 版本,使用 LucideIcons.house
|
|||
|
|
2. **login_page.dart** - 替换为 shadcn 版本,修复导入路径
|
|||
|
|
3. **home_page.dart** - 全面重构,使用 ShadTheme, ShadCard, CircleAvatar
|
|||
|
|
4. **market_page.dart** - 全面重构,使用 ShadInput, ShadCard, CircleAvatar
|
|||
|
|
5. **trade_page.dart** - 全面重构,使用 ShadInputFormField, ShadButton, ShadCard
|
|||
|
|
6. **asset_page.dart** - 全面重构,使用 ShadTheme, ShadCard, ShadDialog
|
|||
|
|
7. **mine_page.dart** - 全面重构,使用 ShadTheme, ShadCard, ShadButton.destructive
|
|||
|
|
|
|||
|
|
### API 兼容性修复
|
|||
|
|
- ShadAvatar -> CircleAvatar(ShadAvatar 需要位置参数)
|
|||
|
|
- ShadDialog.content -> ShadDialog.child
|
|||
|
|
- ShadInputFormField.suffix -> ShadInputFormField.trailing
|
|||
|
|
- LucideIcons.home -> LucideIcons.house
|
|||
|
|
- LucideIcons.checkCircle -> LucideIcons.circleCheck
|
|||
|
|
- LucideIcons.alertCircle -> LucideIcons.circleAlert
|
|||
|
|
- LucideIcons.coin -> LucideIcons.coins
|
|||
|
|
- withOpacity() -> withValues(alpha:)
|
|||
|
|
|
|||
|
|
### 组件创建
|
|||
|
|
- `lib/ui/components/coin_card.dart` - 可复用的币种卡片
|
|||
|
|
- `lib/ui/components/trade_button.dart` - 买入/卖出按钮组件
|
|||
|
|
- `lib/ui/components/asset_card.dart` - 资产展示卡片
|
|||
|
|
- `lib/ui/components/components.dart` - 导出文件
|
|||
|
|
|
|||
|
|
## Issues Found & Resolved
|
|||
|
|
|
|||
|
|
### API 兼容性问题
|
|||
|
|
1. **ShadAvatar API** - ShadAvatar 需要位置参数,改用 CircleAvatar
|
|||
|
|
2. **ShadDialog.content** - 应使用 child 参数
|
|||
|
|
3. **ShadInputFormField.suffix** - 应使用 trailing 参数
|
|||
|
|
4. **LucideIcons 命名** - 部分图标名称不同(home->house, checkCircle->circleCheck)
|
|||
|
|
|
|||
|
|
### 解决方案
|
|||
|
|
- 使用 CircleAvatar 替代 ShadAvatar
|
|||
|
|
- 将 content 改为 child
|
|||
|
|
- 将 suffix 改为 trailing
|
|||
|
|
- 使用正确的 LucideIcons 名称
|
|||
|
|
|
|||
|
|
## Verification
|
|||
|
|
|
|||
|
|
### Flutter Analyze
|
|||
|
|
```
|
|||
|
|
flutter analyze
|
|||
|
|
```
|
|||
|
|
结果:0 errors,仅剩少量 warnings(unused imports, unnecessary null checks)
|
|||
|
|
|
|||
|
|
### 功能验证
|
|||
|
|
- [ ] 用户登录/注册
|
|||
|
|
- [ ] 查看行情数据
|
|||
|
|
- [ ] 进行交易操作
|
|||
|
|
- [ ] 查看资产信息
|
|||
|
|
- [ ] 修改个人设置
|
|||
|
|
|
|||
|
|
## Completion
|
|||
|
|
|
|||
|
|
STATUS: COMPLETE
|
|||
|
|
|
|||
|
|
所有 P0 和 P1 优先级任务已完成:
|
|||
|
|
- ✅ 核心页面已全部重构为 shadcn_ui 组件
|
|||
|
|
- ✅ 所有按钮使用 ShadButton
|
|||
|
|
- ✅ 所有卡片使用 ShadCard
|
|||
|
|
- ✅ 所有输入框使用 ShadInputFormField
|
|||
|
|
- ✅ 所有图标使用 LucideIcons
|
|||
|
|
- ✅ 自定义组件已创建
|
|||
|
|
- ✅ flutter analyze 无错误
|
|||
|
|
|
|||
|
|
## Next Steps (Optional)
|
|||
|
|
|
|||
|
|
1. **动画优化** - 使用 flutter_animate 添加更多动画效果
|
|||
|
|
2. **浅色模式** - 添加浅色主题支持
|
|||
|
|
3. **品牌色定制** - 从 Slate 主题切换到自定义绿色主题
|
|||
|
|
4. **组件优化** - 进一步优化自定义组件的可配置性
|