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,6 +1,5 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -9,7 +8,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'core/network/dio_client.dart';
|
||||
import 'core/storage/local_storage.dart';
|
||||
import 'core/theme/app_color_scheme.dart';
|
||||
import 'core/theme/app_theme.dart';
|
||||
import 'core/event/app_event_bus.dart';
|
||||
import 'data/services/user_service.dart';
|
||||
@@ -67,18 +65,7 @@ class MyApp extends StatelessWidget {
|
||||
providers: _buildProviders(),
|
||||
child: Consumer<ThemeProvider>(
|
||||
builder: (context, themeProvider, _) {
|
||||
return ShadApp.custom(
|
||||
themeMode: themeProvider.themeMode,
|
||||
theme: ShadThemeData(
|
||||
colorScheme: AppColorScheme.lightShad,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
darkTheme: ShadThemeData(
|
||||
colorScheme: AppColorScheme.darkShad,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
appBuilder: (context) => _buildMaterialApp(context, themeProvider.themeMode),
|
||||
);
|
||||
return _buildMaterialApp(context, themeProvider.themeMode);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -130,13 +117,11 @@ class MyApp extends StatelessWidget {
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: themeMode,
|
||||
localizationsDelegates: const [
|
||||
GlobalShadLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
builder: (context, child) {
|
||||
child = ShadAppBuilder(child: child!);
|
||||
// 配置 BotToast 確保顯示在所有內容之上
|
||||
final botToastBuilder = BotToastInit();
|
||||
child = botToastBuilder(context, child);
|
||||
|
||||
Reference in New Issue
Block a user