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:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/theme/app_spacing.dart';
|
||||
import '../../core/theme/app_theme_extension.dart';
|
||||
|
||||
@@ -31,11 +31,12 @@ class CoinCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ShadTheme.of(context);
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return ShadCard(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
child: InkWell(
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -66,13 +67,13 @@ class CoinCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'$code/USDT',
|
||||
style: theme.textTheme.large.copyWith(
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
name,
|
||||
style: theme.textTheme.muted,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -95,6 +96,7 @@ class CoinCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user