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,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../components/material_input.dart';
import 'package:provider/provider.dart';
import '../../../../core/theme/app_theme.dart';
import '../../../../core/theme/app_theme_extension.dart';
@@ -129,10 +129,10 @@ class WalletAddressCard extends StatelessWidget {
/// 充值對話框
void showDepositDialog(BuildContext context) {
final amountController = TextEditingController();
final formKey = GlobalKey<ShadFormState>();
final formKey = GlobalKey<FormState>();
final colorScheme = Theme.of(context).colorScheme;
showShadDialog(
showDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: Colors.transparent,
@@ -178,22 +178,21 @@ void showDepositDialog(BuildContext context) {
],
),
const SizedBox(height: AppSpacing.lg),
ShadForm(
Form(
key: formKey,
child: ShadInputFormField(
id: 'amount',
controller: amountController,
label: const Text('充值金額'),
placeholder: const Text('最低 1000 USDT'),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
validator: (v) {
if (v == null || v.isEmpty) return '請輸入金額';
final n = double.tryParse(v);
if (n == null || n <= 0) return '請輸入有效金額';
if (n < 1000) return '單筆最低充值1000 USDT';
return null;
},
),
child: MaterialInput(
controller: amountController,
labelText: '充值金額',
hintText: '最低 1000 USDT',
keyboardType: const TextInputType.numberWithOptions(decimal: true),
validator: (v) {
if (v == null || v.isEmpty) return '請輸入金額';
final n = double.tryParse(v);
if (n == null || n <= 0) return '請輸入有效金額';
if (n < 1000) return '單筆最低充值1000 USDT';
return null;
},
),
),
const SizedBox(height: AppSpacing.lg),
Row(
@@ -213,7 +212,7 @@ void showDepositDialog(BuildContext context) {
text: '下一步',
type: NeonButtonType.primary,
onPressed: () async {
if (formKey.currentState!.saveAndValidate()) {
if (formKey.currentState!.validate()) {
Navigator.of(ctx).pop();
final response = await context.read<AssetProvider>().deposit(
amount: amountController.text,
@@ -248,7 +247,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
final walletNetwork = data['walletNetwork'] as String? ?? 'TRC20';
final colorScheme = Theme.of(context).colorScheme;
showShadDialog(
showDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: Colors.transparent,
@@ -359,7 +358,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
final amountController = TextEditingController();
final addressController = TextEditingController();
final contactController = TextEditingController();
final formKey = GlobalKey<ShadFormState>();
final formKey = GlobalKey<FormState>();
final feeNotifier = ValueNotifier<String>('提現將扣除10%手續費');
final networksNotifier = ValueNotifier<List<String>>([]);
final selectedNetworkNotifier = ValueNotifier<String?>(null);
@@ -384,7 +383,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
}
});
showShadDialog(
showDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: Colors.transparent,
@@ -460,17 +459,21 @@ void showWithdrawDialog(BuildContext context, String? balance) {
),
],
const SizedBox(height: AppSpacing.lg),
ShadForm(
Form(
key: formKey,
child: Column(
children: [
ShadInputFormField(
id: 'amount',
MaterialInput(
controller: amountController,
label: const Text('提現金額'),
placeholder: const Text('請輸入提現金額(USDT)'),
labelText: '提現金額',
hintText: '請輸入提現金額(USDT)',
keyboardType: const TextInputType.numberWithOptions(decimal: true),
validator: Validators.amount,
validator: (v) {
if (v == null || v.isEmpty) return '請輸入金額';
final n = double.tryParse(v);
if (n == null || n <= 0) return '請輸入有效金額';
return null;
},
),
const SizedBox(height: AppSpacing.md),
// 手續費/應收款提示
@@ -518,14 +521,16 @@ void showWithdrawDialog(BuildContext context, String? balance) {
builder: (_, selected, __) {
return SizedBox(
width: double.infinity,
child: ShadSelect<String>(
placeholder: const Text('選擇提現網絡'),
initialValue: selected,
selectedOptionBuilder: (context, val) => Text(val),
child: DropdownButtonFormField<String>(
value: selected,
hint: const Text('選擇提現網絡'),
decoration: InputDecoration(
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
onChanged: (value) {
if (value != null) selectedNetworkNotifier.value = value;
},
options: networks.map((n) => ShadOption(value: n, child: Text(n))).toList(),
items: networks.map((n) => DropdownMenuItem(value: n, child: Text(n))).toList(),
),
);
},
@@ -535,19 +540,20 @@ void showWithdrawDialog(BuildContext context, String? balance) {
},
),
const SizedBox(height: AppSpacing.md),
ShadInputFormField(
id: 'address',
MaterialInput(
controller: addressController,
label: const Text('目標地址'),
placeholder: const Text('請輸入提現地址'),
validator: (v) => Validators.required(v, '提現地址'),
labelText: '目標地址',
hintText: '請輸入提現地址',
validator: (v) {
if (v == null || v.isEmpty) return '請輸入提現地址';
return null;
},
),
const SizedBox(height: AppSpacing.md),
ShadInputFormField(
id: 'contact',
MaterialInput(
controller: contactController,
label: const Text('聯繫方式(可選)'),
placeholder: const Text('聯繫方式'),
labelText: '聯繫方式(可選)',
hintText: '聯繫方式',
),
],
),
@@ -570,7 +576,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
text: '提交',
type: NeonButtonType.primary,
onPressed: () async {
if (formKey.currentState!.saveAndValidate()) {
if (formKey.currentState!.validate()) {
Navigator.of(ctx).pop();
final response = await context.read<AssetProvider>().withdraw(
amount: amountController.text,
@@ -619,7 +625,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
void showResultDialog(BuildContext context, String title, String? message) {
final colorScheme = Theme.of(context).colorScheme;
showShadDialog(
showDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: Colors.transparent,

View File

@@ -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,

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';

View File

@@ -1,7 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_theme_extension.dart';
@@ -87,12 +87,12 @@ class _HomePageState extends State<HomePage>
super.build(context);
return Scaffold(
backgroundColor: context.colors.background,
backgroundColor: Theme.of(context).colorScheme.background,
body: Consumer<AssetProvider>(
builder: (context, provider, _) {
return RefreshIndicator(
onRefresh: () => provider.refreshAll(force: true),
color: context.colors.primary,
color: Theme.of(context).colorScheme.primary,
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only(
@@ -270,7 +270,7 @@ class _AssetCardState extends State<_AssetCard> {
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: context.colors.primary,
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Row(
@@ -280,7 +280,7 @@ class _AssetCardState extends State<_AssetCard> {
Text(
'充值',
style: AppTextStyles.labelLarge(context).copyWith(
color: context.colors.onPrimary,
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 12,
),
),
@@ -359,9 +359,9 @@ class _WelfareCard extends StatelessWidget {
width: double.infinity,
padding: EdgeInsets.all(AppSpacing.lg),
decoration: BoxDecoration(
color: context.colors.surface,
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.xl),
border: Border.all(color: context.colors.outlineVariant.withValues(alpha: 0.2)),
border: Border.all(color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.2)),
),
child: Row(
children: [
@@ -370,12 +370,12 @@ class _WelfareCard extends StatelessWidget {
width: 48,
height: 48,
decoration: BoxDecoration(
color: context.colors.primary.withValues(alpha: 0.15),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(AppRadius.lg),
),
child: Icon(
LucideIcons.gift,
color: context.colors.primary,
color: Theme.of(context).colorScheme.primary,
size: 24,
),
),
@@ -426,7 +426,7 @@ class _WelfareCard extends StatelessWidget {
style: AppTextStyles.bodySmall(context).copyWith(
fontSize: 10,
fontWeight: FontWeight.bold,
color: context.colors.onPrimary,
color: Theme.of(context).colorScheme.onPrimary,
),
),
),
@@ -504,13 +504,13 @@ class _EmptyHoldings extends StatelessWidget {
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: AppSpacing.xxl, horizontal: AppSpacing.lg),
decoration: BoxDecoration(
color: context.colors.surfaceContainerLow.withValues(alpha: 0.5),
color: Theme.of(context).colorScheme.surfaceContainerLow.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(AppRadius.xxl),
border: Border.all(color: context.colors.outlineVariant.withValues(alpha: 0.1)),
border: Border.all(color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.1)),
),
child: Column(
children: [
Icon(LucideIcons.wallet, size: 48, color: context.colors.onSurfaceVariant),
Icon(LucideIcons.wallet, size: 48, color: Theme.of(context).colorScheme.onSurfaceVariant),
SizedBox(height: AppSpacing.md),
Text(
'暫無持倉',
@@ -542,9 +542,9 @@ class _HoldingsList extends StatelessWidget {
return Container(
decoration: BoxDecoration(
color: context.colors.surface.withValues(alpha: 0.5),
color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(AppRadius.xxl),
border: Border.all(color: context.colors.outlineVariant.withValues(alpha: 0.1)),
border: Border.all(color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.1)),
),
child: ListView.separated(
shrinkWrap: true,

View File

@@ -1,5 +1,4 @@
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';
@@ -36,9 +35,9 @@ class HotCoinsSection extends StatelessWidget {
// Card
Container(
decoration: BoxDecoration(
color: context.colors.surfaceContainer,
color: Theme.of(context).colorScheme.surfaceContainer,
border: Border.all(
color: context.colors.outlineVariant,
color: Theme.of(context).colorScheme.outlineVariant,
width: 1,
),
borderRadius: BorderRadius.circular(AppRadius.xl),

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_spacing.dart';

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../core/theme/app_color_scheme.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_theme.dart';
import '../../../providers/asset_provider.dart';

View File

@@ -1,7 +1,7 @@
import 'dart:typed_data';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import 'package:image_picker/image_picker.dart';
import '../../../core/theme/app_color_scheme.dart';
@@ -431,9 +431,9 @@ class _KycPageState extends State<KycPage> {
if (!mounted) return;
if (response.success) {
showShadDialog(
showDialog(
context: context,
builder: (ctx) => ShadDialog.alert(
builder: (ctx) => AlertDialog(
title: Row(
children: [
NeonIcon(
@@ -445,9 +445,9 @@ class _KycPageState extends State<KycPage> {
const Text('認證成功'),
],
),
description: const Text('您的實名認證已通過,現在可以進行提現操作'),
content: const Text('您的實名認證已通過,現在可以進行提現操作'),
actions: [
ShadButton(
TextButton(
child: const Text('確定'),
onPressed: () {
Navigator.of(ctx).pop();
@@ -458,13 +458,13 @@ class _KycPageState extends State<KycPage> {
),
);
} else {
showShadDialog(
showDialog(
context: context,
builder: (ctx) => ShadDialog.alert(
builder: (ctx) => AlertDialog(
title: const Text('認證失敗'),
description: Text(response.message ?? '請稍後重試'),
content: Text(response.message ?? '請稍後重試'),
actions: [
ShadButton(
TextButton(
child: const Text('確定'),
onPressed: () => Navigator.of(ctx).pop(),
),
@@ -474,13 +474,13 @@ class _KycPageState extends State<KycPage> {
}
} catch (e) {
if (mounted) {
showShadDialog(
showDialog(
context: context,
builder: (ctx) => ShadDialog.alert(
builder: (ctx) => AlertDialog(
title: const Text('認證失敗'),
description: Text(e.toString()),
content: Text(e.toString()),
actions: [
ShadButton(
TextButton(
child: const Text('確定'),
onPressed: () => Navigator.of(ctx).pop(),
),

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_theme.dart';
@@ -145,9 +145,9 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
final goldAccent = context.appColors.accentPrimary;
return Scaffold(
backgroundColor: context.colors.surface,
backgroundColor: Theme.of(context).colorScheme.surface,
appBar: AppBar(
backgroundColor: context.colors.surface,
backgroundColor: Theme.of(context).colorScheme.surface,
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: false,
@@ -157,7 +157,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
style: AppTextStyles.headlineLarge(context),
),
leading: IconButton(
icon: Icon(LucideIcons.arrowLeft, color: context.colors.onSurface, size: 24),
icon: Icon(LucideIcons.arrowLeft, color: Theme.of(context).colorScheme.onSurface, size: 24),
onPressed: () => Navigator.of(context).pop(),
),
),
@@ -242,7 +242,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
},
style: ElevatedButton.styleFrom(
backgroundColor: goldAccent,
foregroundColor: context.colors.onPrimary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.lg),
@@ -251,7 +251,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
),
child: Text(
'複製邀請碼',
style: AppTextStyles.headlineMedium(context).copyWith(color: context.colors.onPrimary),
style: AppTextStyles.headlineMedium(context).copyWith(color: Theme.of(context).colorScheme.onPrimary),
),
),
),
@@ -325,21 +325,21 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
'+100 USDT',
style: AppTextStyles.displayLarge(context).copyWith(
fontWeight: FontWeight.w800,
color: claimed ? context.colors.onSurfaceVariant : profitGreen,
color: claimed ? Theme.of(context).colorScheme.onSurfaceVariant : profitGreen,
),
),
const SizedBox(height: 8),
Text(
description,
style: AppTextStyles.bodyLarge(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 16),
_fullWidthButton(
text: buttonText,
backgroundColor: profitGreen,
foregroundColor: context.colors.onPrimary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
onPressed: canClaim ? () => _claimNewUserBonus() : null,
),
],
@@ -425,12 +425,12 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
child: Column(
children: [
Text(label, style: AppTextStyles.bodySmall(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
)),
const SizedBox(height: 2),
Text(value, style: AppTextStyles.headlineSmall(context).copyWith(
fontWeight: FontWeight.w700,
color: highlight ? context.appColors.up : context.colors.onSurface,
color: highlight ? context.appColors.up : Theme.of(context).colorScheme.onSurface,
)),
],
),
@@ -452,7 +452,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
Text(
'暫無推廣用戶',
style: AppTextStyles.bodyLarge(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
@@ -592,7 +592,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
label = '${threshold}';
} else {
bgColor = context.appColors.surfaceCardHigh;
textColor = context.colors.onSurfaceVariant;
textColor = Theme.of(context).colorScheme.onSurfaceVariant;
label = '${threshold}';
}
@@ -631,7 +631,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
child: Text(
username.isNotEmpty ? username[0].toUpperCase() : '?',
style: AppTextStyles.headlineSmall(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
@@ -719,7 +719,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
Text(
'已推廣 $indirectRefCount',
style: AppTextStyles.bodyMedium(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
if (indirectClaimableCount > 0) ...[
@@ -773,7 +773,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
label = '50\u{1F381}';
} else {
bgColor = context.appColors.surfaceCardHigh;
textColor = context.colors.onSurfaceVariant;
textColor = Theme.of(context).colorScheme.onSurfaceVariant;
label = '50';
}
@@ -841,7 +841,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
child: Text(
'\u2022 $text',
style: AppTextStyles.bodyMedium(context).copyWith(
color: context.colors.onSurfaceVariant,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
);

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),
),
);

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:provider/provider.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_color_scheme.dart';
@@ -84,7 +83,7 @@ class _FundOrderCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
final isDeposit = order.type == 1;
final statusColor = _getStatusColor(order.status, isDeposit);
@@ -93,9 +92,10 @@ class _FundOrderCard extends StatelessWidget {
? order.receivableAmount
: order.amount;
return ShadCard(
padding: AppSpacing.cardPadding,
child: Column(
return Card(
child: Padding(
padding: AppSpacing.cardPadding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
@@ -126,7 +126,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.fee != null) ...[
Row(
children: [
Text('手續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('手續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text('-${order.fee} USDT', style: AppTextStyles.bodyMedium(context)),
],
),
@@ -135,7 +135,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.receivableAmount != null) ...[
Row(
children: [
Text('到賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('到賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text('${order.receivableAmount} USDT', style: AppTextStyles.bodyMedium(context).copyWith(fontWeight: FontWeight.w700)),
],
),
@@ -144,7 +144,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.network != null) ...[
Row(
children: [
Text('提現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('提現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(order.network!, style: AppTextStyles.bodyMedium(context)),
],
),
@@ -153,7 +153,7 @@ class _FundOrderCard extends StatelessWidget {
if (order.walletAddress != null) ...[
Row(
children: [
Text('提現地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('提現地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Expanded(
child: Text(
order.walletAddress!,
@@ -169,14 +169,14 @@ class _FundOrderCard extends StatelessWidget {
],
Row(
children: [
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(order.orderNo, style: AppTextStyles.bodyMedium(context)),
],
),
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(
order.createTime?.toString() ?? '',
style: AppTextStyles.bodyMedium(context),
@@ -187,7 +187,7 @@ class _FundOrderCard extends StatelessWidget {
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('駁回原因: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('駁回原因: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Expanded(
child: Text(
order.rejectReason!,
@@ -202,14 +202,14 @@ class _FundOrderCard extends StatelessWidget {
Row(
children: [
Expanded(
child: ShadButton.outline(
child: OutlinedButton(
onPressed: () => _handleConfirmPay(context),
child: const Text('已打款'),
),
),
SizedBox(width: AppSpacing.sm),
Expanded(
child: ShadButton.outline(
child: OutlinedButton(
onPressed: () => _handleCancel(context),
child: const Text('取消訂單'),
),
@@ -219,6 +219,7 @@ class _FundOrderCard extends StatelessWidget {
],
],
),
),
);
}

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
@@ -16,7 +16,7 @@ class FundOrdersList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
final orders = provider.fundOrders;
if (orders.isEmpty) {
@@ -33,7 +33,7 @@ class FundOrdersList extends StatelessWidget {
physics: const AlwaysScrollableScrollPhysics(),
padding: AppSpacing.pagePadding,
itemCount: orders.length,
separatorBuilder: (_, __) => Divider(color: theme.colorScheme.border, height: 1),
separatorBuilder: (_, __) => Divider(color: theme.colorScheme.outline, height: 1),
itemBuilder: (context, index) {
final order = orders[index];
return FundOrderCard(order: order);
@@ -52,7 +52,7 @@ class _EmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
return Center(
child: Padding(
@@ -60,9 +60,9 @@ class _EmptyState extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 48, color: theme.colorScheme.mutedForeground),
Icon(icon, size: 48, color: theme.colorScheme.onSurfaceVariant),
SizedBox(height: AppSpacing.sm + AppSpacing.xs),
Text(message, style: theme.textTheme.muted),
Text(message, style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
],
),
),
@@ -155,13 +155,14 @@ class _FundOrderCardContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
final isDeposit = order.type == 1;
final statusColor = _getStatusColor(order.status, isDeposit);
return ShadCard(
padding: AppSpacing.cardPadding,
child: Column(
return Card(
child: Padding(
padding: AppSpacing.cardPadding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
@@ -192,7 +193,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.fee != null) ...[
Row(
children: [
Text('手續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('手續費(10%): ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text('-${order.fee} USDT', style: AppTextStyles.bodyMedium(context)),
],
),
@@ -201,7 +202,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.receivableAmount != null) ...[
Row(
children: [
Text('到賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('到賬金額: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text('${order.receivableAmount} USDT', style: AppTextStyles.bodyMedium(context).copyWith(fontWeight: FontWeight.w700)),
],
),
@@ -210,7 +211,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.network != null) ...[
Row(
children: [
Text('提現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('提現網絡: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(order.network!, style: AppTextStyles.bodyMedium(context)),
],
),
@@ -219,7 +220,7 @@ class _FundOrderCardContent extends StatelessWidget {
if (order.walletAddress != null) ...[
Row(
children: [
Text('提現地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('提現地址: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Expanded(
child: Text(
order.walletAddress!,
@@ -234,14 +235,14 @@ class _FundOrderCardContent extends StatelessWidget {
],
Row(
children: [
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('訂單號: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(order.orderNo, style: AppTextStyles.bodyMedium(context)),
],
),
SizedBox(height: AppSpacing.xs),
Row(
children: [
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.mutedForeground)),
Text('創建時間: ', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
Text(
order.createTime?.toString() ?? '',
style: AppTextStyles.bodyMedium(context),
@@ -250,6 +251,7 @@ class _FundOrderCardContent extends StatelessWidget {
),
],
),
),
);
}
}

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
@@ -35,10 +35,10 @@ class _OrdersPageState extends State<OrdersPage> with AutomaticKeepAliveClientMi
@override
Widget build(BuildContext context) {
super.build(context);
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
return Scaffold(
backgroundColor: theme.colorScheme.background,
backgroundColor: theme.colorScheme.surface,
body: Consumer<AssetProvider>(
builder: (context, provider, _) {
return RefreshIndicator(
@@ -83,12 +83,12 @@ class TabSelector extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
return Container(
padding: const EdgeInsets.all(AppSpacing.xs),
decoration: BoxDecoration(
color: theme.colorScheme.card,
color: theme.colorScheme.surfaceContainer,
borderRadius: AppRadius.radiusLg,
),
child: Row(
@@ -115,7 +115,7 @@ class TabSelector extends StatelessWidget {
color: context.colors.surface,
)
: AppTextStyles.labelLarge(context).copyWith(
color: theme.colorScheme.mutedForeground,
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w400,
),
),
@@ -137,7 +137,7 @@ class TradeOrdersList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final theme = Theme.of(context);
return Center(
child: Padding(
@@ -145,9 +145,9 @@ class TradeOrdersList extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(LucideIcons.receipt, size: 48, color: theme.colorScheme.mutedForeground),
Icon(LucideIcons.receipt, size: 48, color: theme.colorScheme.onSurfaceVariant),
SizedBox(height: AppSpacing.sm + AppSpacing.xs),
Text('暫無交易記錄', style: theme.textTheme.muted),
Text('暫無交易記錄', style: AppTextStyles.bodyMedium(context).copyWith(color: theme.colorScheme.onSurfaceVariant)),
],
),
),

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../core/theme/app_theme_extension.dart';
@@ -125,7 +125,7 @@ class _TradePageState extends State<TradePage>
super.build(context);
return Scaffold(
backgroundColor: context.colors.background,
backgroundColor: Theme.of(context).colorScheme.surface,
body: Consumer2<MarketProvider, AssetProvider>(
builder: (context, market, asset, _) {
return SafeArea(
@@ -280,25 +280,25 @@ class _TradePageState extends State<TradePage>
}
void _showResultDialog(bool success, String title, String message) {
showShadDialog(
showDialog(
context: context,
builder: (ctx) => ShadDialog.alert(
builder: (ctx) => AlertDialog(
title: Row(
children: [
NeonIcon(
icon: success ? Icons.check_circle : Icons.error,
color: success
? ctx.appColors.up
: ctx.colors.error,
: Theme.of(ctx).colorScheme.error,
size: 24,
),
SizedBox(width: AppSpacing.sm),
Text(title),
],
),
description: Text(message),
content: Text(message),
actions: [
ShadButton(
TextButton(
child: const Text('確定'),
onPressed: () => Navigator.of(ctx).pop(),
),