refactor: 批量替换 shadcn_ui 为 Material Design 组件

## 样式主题重点优化

### 颜色映射(注重主题一致性)
- mutedForeground → onSurfaceVariant
- border → outline
- card → surfaceContainer
- destructive → error
- 保留所有 AppColorScheme 自定义颜色

### 文本样式映射
- theme.textTheme.h1/muted/large → AppTextStyles.xxx(context)
- 统一使用项目定义的文本样式系统

### 组件替换(20个文件)
- ShadApp → MaterialApp(移除 ShadThemeData)
- ShadButton → ElevatedButton/OutlinedButton
- ShadDialog → AlertDialog
- ShadInputFormField → MaterialInput
- ShadSelect → DropdownButtonFormField
- ShadCard → Card
- showShadDialog → showDialog

### 依赖变更
- 移除:shadcn_ui: ^0.52.1
- 添加:lucide_icons_flutter: ^2.0.0

### 业务逻辑保护
 所有 onPressed/onChanged/validator 回调保持不变
 所有 controller/focusNode 数据绑定保持不变
 所有布局结构(Column/Row/Padding)保持不变
 仅替换 UI 组件层,业务逻辑完全保留
This commit is contained in:
2026-04-08 12:24:24 +08:00
parent 5ee87136a7
commit 658f49e280
24 changed files with 281 additions and 455 deletions

View File

@@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_theme_extension.dart';
import '../../../core/storage/local_storage.dart';
/// 引導頁數據模型
@@ -93,7 +92,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: context.colors.surface,
backgroundColor: Theme.of(context).colorScheme.surface,
body: SafeArea(
child: Column(
children: [
@@ -111,7 +110,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
child: Text(
'跳過',
style: AppTextStyles.headlineMedium(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
@@ -159,8 +158,8 @@ class _OnboardingPageState extends State<OnboardingPage> {
child: ElevatedButton(
onPressed: _nextPage,
style: ElevatedButton.styleFrom(
backgroundColor: context.colors.primary,
foregroundColor: context.colors.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.lg),
),
@@ -221,7 +220,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
return Icon(
item.icon ?? LucideIcons.image,
size: 72,
color: context.colors.onPrimary,
color: Theme.of(context).colorScheme.onPrimary,
);
},
),
@@ -229,7 +228,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
: Icon(
item.icon ?? LucideIcons.star,
size: 72,
color: context.colors.onPrimary,
color: Theme.of(context).colorScheme.onPrimary,
),
),
),
@@ -239,7 +238,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
item.title,
style: AppTextStyles.displaySmall(context).copyWith(
fontWeight: FontWeight.bold,
color: context.colors.onSurface,
color: Theme.of(context).colorScheme.onSurface,
letterSpacing: -0.5,
),
),
@@ -249,7 +248,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
item.description,
textAlign: TextAlign.center,
style: AppTextStyles.headlineMedium(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
height: 1.6,
),
),
@@ -267,7 +266,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
width: isActive ? 24 : 8,
height: 8,
decoration: BoxDecoration(
color: isActive ? context.colors.primary : context.colors.outlineVariant,
color: isActive ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.outlineVariant,
borderRadius: BorderRadius.circular(AppRadius.sm),
),
);