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,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
/// Material Design 3 顏色系統 - Pencil Design Theme
|
||||
///
|
||||
@@ -252,60 +251,6 @@ class AppColorScheme {
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
// ============================================
|
||||
// Shadcn ColorScheme - 深色主題
|
||||
// ============================================
|
||||
|
||||
static ShadColorScheme get darkShad => ShadColorScheme(
|
||||
background: darkBackground,
|
||||
foreground: darkOnSurface,
|
||||
card: darkSurfaceContainer,
|
||||
cardForeground: darkOnSurface,
|
||||
popover: darkSurfaceContainerHigh,
|
||||
popoverForeground: darkOnSurface,
|
||||
primary: darkPrimary,
|
||||
primaryForeground: darkOnPrimary,
|
||||
secondary: darkSecondary,
|
||||
secondaryForeground: darkOnSecondary,
|
||||
muted: darkSurfaceContainerHigh,
|
||||
mutedForeground: darkOnSurfaceVariant,
|
||||
accent: darkPrimary.withValues(alpha: 0.15),
|
||||
accentForeground: darkPrimary,
|
||||
destructive: error,
|
||||
destructiveForeground: darkOnSurface,
|
||||
border: darkOutlineVariant.withValues(alpha: 0.15),
|
||||
input: darkOutlineVariant.withValues(alpha: 0.15),
|
||||
ring: darkPrimary,
|
||||
selection: darkPrimary.withValues(alpha: 0.3),
|
||||
);
|
||||
|
||||
// ============================================
|
||||
// Shadcn ColorScheme - 淺色主題
|
||||
// ============================================
|
||||
|
||||
static ShadColorScheme get lightShad => ShadColorScheme(
|
||||
background: lightBackground,
|
||||
foreground: lightOnSurface,
|
||||
card: lightSurfaceLowest,
|
||||
cardForeground: lightOnSurface,
|
||||
popover: lightSurfaceLowest,
|
||||
popoverForeground: lightOnSurface,
|
||||
primary: lightPrimary,
|
||||
primaryForeground: const Color(0xFFFFFFFF),
|
||||
secondary: lightSecondary,
|
||||
secondaryForeground: const Color(0xFFFFFFFF),
|
||||
muted: lightSurfaceHigh,
|
||||
mutedForeground: lightOnSurfaceVariant,
|
||||
accent: lightSecondary.withValues(alpha: 0.1),
|
||||
accentForeground: lightSecondary,
|
||||
destructive: error,
|
||||
destructiveForeground: const Color(0xFFFFFFFF),
|
||||
border: lightOutlineVariant.withValues(alpha: 0.5),
|
||||
input: lightOutlineVariant.withValues(alpha: 0.3),
|
||||
ring: lightSecondary,
|
||||
selection: lightSecondary.withValues(alpha: 0.2),
|
||||
);
|
||||
|
||||
// ============================================
|
||||
// Material ColorScheme - 深色主題 (Material Design 3)
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user