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,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_chen_kchart/k_chart.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:decimal/decimal.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
@@ -16,7 +16,7 @@ class ChartPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return ChangeNotifierProvider(
|
||||
create: (_) => ChartProvider()
|
||||
@@ -137,7 +137,7 @@ class ChartPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildPriceHeader(BuildContext context, ChartProvider provider) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final candles = provider.candles;
|
||||
|
||||
if (candles.isEmpty) return const SizedBox.shrink();
|
||||
@@ -213,7 +213,7 @@ class ChartPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildDataItem(BuildContext context, String label, String value) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -224,7 +224,7 @@ class ChartPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildIntervalTabs(BuildContext context, ChartProvider provider) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
height: 40,
|
||||
@@ -260,7 +260,7 @@ class ChartPage extends StatelessWidget {
|
||||
|
||||
/// 底部指标切换(官方 demo 风格)
|
||||
Widget _buildIndicatorTabs(BuildContext context, ChartProvider provider) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final selectedColor = colorScheme.primary;
|
||||
final unselectedColor = colorScheme.onSurfaceVariant;
|
||||
|
||||
@@ -361,7 +361,7 @@ class ChartPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildBottomActions(BuildContext context, ChartProvider provider) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
@@ -414,7 +414,7 @@ class ChartPage extends StatelessWidget {
|
||||
Widget _buildTitle(BuildContext context) {
|
||||
return Consumer<ChartProvider>(
|
||||
builder: (context, provider, _) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -428,7 +428,7 @@ class ChartPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildErrorView(BuildContext context, ChartProvider provider) {
|
||||
final colorScheme = context.colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
Reference in New Issue
Block a user