docs(theme): update documentation and clean up deprecated color scheme definitions
Removed outdated compatibility aliases and deprecated methods from AppColorScheme, and updated CLAUDE.md to reflect new theme system requirements with centralized color management and no hard-coded values in UI components.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/event/app_event_bus.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import 'components/account_tab_switcher.dart';
|
||||
@@ -81,11 +81,7 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
||||
child: Text(
|
||||
'资产',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
style: AppTextStyles.displaySmall(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
|
||||
/// 账户标签切换器 — .pen node UE6xC
|
||||
@@ -67,12 +67,12 @@ class AccountTabSwitcher extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? colorScheme.surface
|
||||
: Colors.transparent,
|
||||
: const Color(0x00000000),
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
boxShadow: isSelected
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
@@ -82,11 +82,12 @@ class AccountTabSwitcher extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500,
|
||||
color: isSelected ? colorScheme.onSurface : colorScheme.onSurfaceVariant,
|
||||
),
|
||||
style: isSelected
|
||||
? AppTextStyles.headlineMedium(context)
|
||||
: AppTextStyles.headlineMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
|
||||
/// 操作按钮行 — .pen node pIpHe
|
||||
/// gap: 12, three buttons evenly distributed
|
||||
@@ -35,7 +35,7 @@ class ActionButtonsRow extends StatelessWidget {
|
||||
bgColor: bgColor,
|
||||
onTap: onDeposit,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: AppSpacing.sm + AppSpacing.xs),
|
||||
ActionButton(
|
||||
icon: LucideIcons.arrowDownLeft,
|
||||
label: '提现',
|
||||
@@ -43,7 +43,7 @@ class ActionButtonsRow extends StatelessWidget {
|
||||
bgColor: bgColor,
|
||||
onTap: onWithdraw,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: AppSpacing.sm + AppSpacing.xs),
|
||||
ActionButton(
|
||||
icon: LucideIcons.repeat,
|
||||
label: '划转',
|
||||
@@ -96,12 +96,10 @@ class ActionButton extends StatelessWidget {
|
||||
color: accentColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: AppSpacing.xs + 2),
|
||||
Text(
|
||||
label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
style: AppTextStyles.labelLarge(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/utils/toast_utils.dart';
|
||||
@@ -38,17 +38,14 @@ class InfoRow extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
|
||||
color: colorScheme.onSurface,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
fontWeight: isBold ? FontWeight.bold : FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -88,9 +85,8 @@ class WalletAddressCard extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
address,
|
||||
style: const TextStyle(
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -117,10 +113,7 @@ class WalletAddressCard extends StatelessWidget {
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
'网络: $network',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
style: AppTextStyles.bodySmall(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -141,7 +134,7 @@ void showDepositDialog(BuildContext context) {
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
@@ -157,17 +150,14 @@ void showDepositDialog(BuildContext context) {
|
||||
children: [
|
||||
Text(
|
||||
'充值',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
'Asset: USDT',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -261,7 +251,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
@@ -279,10 +269,8 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Text(
|
||||
'充值申请成功',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -294,8 +282,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
Text(
|
||||
'请向以下地址转账:',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -318,7 +305,9 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
Expanded(
|
||||
child: Text(
|
||||
'转账完成后请点击"已打款"按钮确认',
|
||||
style: GoogleFonts.inter(fontSize: 12, color: AppColorScheme.warning),
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: AppColorScheme.warning,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -372,11 +361,12 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
final contactController = TextEditingController();
|
||||
final formKey = GlobalKey<ShadFormState>();
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
@@ -401,10 +391,8 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Text(
|
||||
'提现',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -412,8 +400,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
'安全地将您的资产转移到外部钱包地址',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -425,10 +412,10 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
vertical: AppSpacing.sm,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorScheme.up.withValues(alpha: 0.1),
|
||||
color: AppColorScheme.getUpBackgroundColor(isDark),
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
border: Border.all(
|
||||
color: AppColorScheme.up.withValues(alpha: 0.2),
|
||||
color: AppColorScheme.getUpColor(isDark).withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -436,17 +423,15 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
children: [
|
||||
Text(
|
||||
'可用余额: ',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
style: AppTextStyles.bodySmall(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$balance USDT',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
style: AppTextStyles.labelLarge(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColorScheme.up,
|
||||
color: AppColorScheme.getUpColor(isDark),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -538,7 +523,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
const SizedBox(width: AppSpacing.xs),
|
||||
Text(
|
||||
'End-to-End Encrypted Transaction',
|
||||
style: GoogleFonts.inter(
|
||||
style: AppTextStyles.bodySmall(context).copyWith(
|
||||
fontSize: 10,
|
||||
color: colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
@@ -560,7 +545,7 @@ void showResultDialog(BuildContext context, String title, String? message) {
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
@@ -569,17 +554,17 @@ void showResultDialog(BuildContext context, String title, String? message) {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (message != null) ...[
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
message,
|
||||
style: GoogleFonts.inter(color: colorScheme.onSurfaceVariant),
|
||||
style: AppTextStyles.bodyLarge(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../providers/asset_provider.dart';
|
||||
@@ -37,28 +37,22 @@ class BalanceCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'USDT 余额',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_formatBalance(displayBalance),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
style: AppTextStyles.numberLarge(context),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'\u2248 \$${_formatBalance(displayBalance)} USD',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: isDark ? AppColorScheme.darkOnSurfaceMuted : colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../data/models/account_models.dart';
|
||||
@@ -27,18 +27,13 @@ class HoldingsSection extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'交易账户持仓',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
style: AppTextStyles.headlineLarge(context),
|
||||
),
|
||||
Text(
|
||||
'查看全部 >',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -50,8 +45,7 @@ class HoldingsSection extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(AppSpacing.xl),
|
||||
child: Text(
|
||||
'暂无持仓',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
style: AppTextStyles.bodyLarge(context).copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -143,8 +137,7 @@ class HoldingRow extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
coinCode.substring(0, 1),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: accentColor,
|
||||
),
|
||||
@@ -159,18 +152,13 @@ class HoldingRow extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
coinCode,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
style: AppTextStyles.headlineMedium(context),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
quantity,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -184,18 +172,14 @@ class HoldingRow extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: GoogleFonts.inter(
|
||||
style: AppTextStyles.numberMedium(context).copyWith(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
profitRate,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
style: AppTextStyles.numberSmall(context).copyWith(
|
||||
color: profitColor,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.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';
|
||||
import '../../../components/glass_panel.dart';
|
||||
@@ -30,10 +30,8 @@ class RecordsLinkRow extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'充提记录',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:google_fonts/google_fonts.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';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import '../../../data/models/account_models.dart';
|
||||
@@ -81,17 +82,6 @@ class _TransferPageState extends State<TransferPage> {
|
||||
|
||||
bool get _isDark => Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
/// 一次性获取所有主题感知颜色
|
||||
_TransferColors get _colors => _TransferColors(_isDark);
|
||||
|
||||
TextStyle _inter({
|
||||
required double fontSize,
|
||||
required FontWeight fontWeight,
|
||||
required Color color,
|
||||
}) {
|
||||
return GoogleFonts.inter(fontSize: fontSize, fontWeight: fontWeight, color: color);
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// 业务逻辑
|
||||
// ============================================
|
||||
@@ -162,37 +152,37 @@ class _TransferPageState extends State<TransferPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final c = _colors;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: c.bgSecondary,
|
||||
backgroundColor: colorScheme.surface,
|
||||
appBar: AppBar(
|
||||
backgroundColor: c.surfaceCard,
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
leading: IconButton(
|
||||
icon: Icon(LucideIcons.arrowLeft, color: c.textPrimary, size: 20),
|
||||
icon: Icon(LucideIcons.arrowLeft, color: colorScheme.onSurface, size: 20),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: Text(
|
||||
'账户划转',
|
||||
style: _inter(fontSize: 16, fontWeight: FontWeight.w600, color: c.textPrimary),
|
||||
style: AppTextStyles.headlineLarge(context),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Consumer<AssetProvider>(
|
||||
builder: (context, provider, _) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
|
||||
padding: const EdgeInsets.fromLTRB(AppSpacing.md, AppSpacing.md, AppSpacing.md, AppSpacing.xl),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildTransferDirectionCard(c),
|
||||
const SizedBox(height: 24),
|
||||
_buildAmountSection(c),
|
||||
const SizedBox(height: 24),
|
||||
_buildTipsCard(c),
|
||||
const SizedBox(height: 24),
|
||||
_buildConfirmButton(c),
|
||||
_buildTransferDirectionCard(),
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
_buildAmountSection(),
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
_buildTipsCard(),
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
_buildConfirmButton(),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -205,14 +195,16 @@ class _TransferPageState extends State<TransferPage> {
|
||||
// Transfer direction card
|
||||
// ============================================
|
||||
|
||||
Widget _buildTransferDirectionCard(_TransferColors c) {
|
||||
Widget _buildTransferDirectionCard() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
decoration: BoxDecoration(
|
||||
color: c.surfaceCard,
|
||||
color: colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
border: Border.all(color: c.borderDefault.withValues(alpha: 0.6)),
|
||||
border: Border.all(color: colorScheme.outlineVariant.withValues(alpha: 0.6)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -224,7 +216,6 @@ class _TransferPageState extends State<TransferPage> {
|
||||
label: '从',
|
||||
accountName: _fromLabel,
|
||||
balance: _fromBalance,
|
||||
c: c,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -234,13 +225,13 @@ class _TransferPageState extends State<TransferPage> {
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
margin: const EdgeInsets.symmetric(vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(vertical: AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: c.accentPrimary,
|
||||
color: colorScheme.secondary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(LucideIcons.arrowUpDown, size: 18, color: c.textInverse),
|
||||
child: Icon(LucideIcons.arrowUpDown, size: 18, color: colorScheme.onSecondary),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -253,7 +244,6 @@ class _TransferPageState extends State<TransferPage> {
|
||||
label: '到',
|
||||
accountName: _toLabel,
|
||||
balance: _toBalance,
|
||||
c: c,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -286,15 +276,16 @@ class _TransferPageState extends State<TransferPage> {
|
||||
required String label,
|
||||
required String accountName,
|
||||
required String balance,
|
||||
required _TransferColors c,
|
||||
}) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: _inter(fontSize: 11, fontWeight: FontWeight.normal, color: c.textMuted)),
|
||||
const SizedBox(height: 8),
|
||||
Text(label, style: AppTextStyles.bodySmall(context)),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -303,15 +294,15 @@ class _TransferPageState extends State<TransferPage> {
|
||||
Icon(
|
||||
label == '从' ? LucideIcons.wallet : LucideIcons.repeat,
|
||||
size: 18,
|
||||
color: c.textSecondary,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(accountName, style: _inter(fontSize: 14, fontWeight: FontWeight.w600, color: c.textPrimary)),
|
||||
const SizedBox(width: AppSpacing.sm + 2),
|
||||
Text(accountName, style: AppTextStyles.headlineMedium(context)),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'\u00A5 ${_formatBalance(balance)}',
|
||||
style: _inter(fontSize: 14, fontWeight: FontWeight.w600, color: c.textPrimary),
|
||||
style: AppTextStyles.headlineMedium(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -324,7 +315,9 @@ class _TransferPageState extends State<TransferPage> {
|
||||
// Amount input section
|
||||
// ============================================
|
||||
|
||||
Widget _buildAmountSection(_TransferColors c) {
|
||||
Widget _buildAmountSection() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -332,10 +325,13 @@ class _TransferPageState extends State<TransferPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('划转金额', style: _inter(fontSize: 14, fontWeight: FontWeight.w500, color: c.textSecondary)),
|
||||
Text('划转金额', style: AppTextStyles.headlineSmall(context).copyWith(color: colorScheme.onSurfaceVariant)),
|
||||
GestureDetector(
|
||||
onTap: () => _setQuickAmount(1.0),
|
||||
child: Text('全部划转', style: _inter(fontSize: 12, fontWeight: FontWeight.w600, color: c.goldAccent)),
|
||||
child: Text('全部划转', style: AppTextStyles.labelLarge(context).copyWith(
|
||||
color: colorScheme.secondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -347,9 +343,9 @@ class _TransferPageState extends State<TransferPage> {
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 56,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: c.bgTertiary,
|
||||
color: colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
),
|
||||
child: Row(
|
||||
@@ -363,10 +359,12 @@ class _TransferPageState extends State<TransferPage> {
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,8}')),
|
||||
],
|
||||
style: _inter(fontSize: 28, fontWeight: FontWeight.w700, color: c.textPrimary),
|
||||
style: AppTextStyles.numberLarge(context),
|
||||
decoration: InputDecoration(
|
||||
hintText: '0.00',
|
||||
hintStyle: _inter(fontSize: 28, fontWeight: FontWeight.w700, color: c.textMuted),
|
||||
hintStyle: AppTextStyles.numberLarge(context).copyWith(
|
||||
color: AppColorScheme.darkOnSurfaceMuted,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
isDense: true,
|
||||
@@ -374,8 +372,11 @@ class _TransferPageState extends State<TransferPage> {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: Text('USDT', style: _inter(fontSize: 14, fontWeight: FontWeight.normal, color: c.textMuted)),
|
||||
padding: const EdgeInsets.only(left: AppSpacing.sm),
|
||||
child: Text('USDT', style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColorScheme.darkOnSurfaceMuted,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -390,8 +391,8 @@ class _TransferPageState extends State<TransferPage> {
|
||||
final percent = entry.value;
|
||||
final label = '${(percent * 100).toInt()}%';
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: index > 0 ? 8 : 0),
|
||||
child: _buildPercentButton(label, percent, c),
|
||||
padding: EdgeInsets.only(left: index > 0 ? AppSpacing.sm : 0),
|
||||
child: _buildPercentButton(label, percent),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
@@ -399,18 +400,20 @@ class _TransferPageState extends State<TransferPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPercentButton(String label, double percent, _TransferColors c) {
|
||||
Widget _buildPercentButton(String label, double percent) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => _setQuickAmount(percent),
|
||||
child: Container(
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: c.bgTertiary,
|
||||
color: colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(label, style: _inter(fontSize: 13, fontWeight: FontWeight.w500, color: c.textSecondary)),
|
||||
child: Text(label, style: AppTextStyles.headlineSmall(context)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -421,22 +424,24 @@ class _TransferPageState extends State<TransferPage> {
|
||||
// Tips card & Confirm button
|
||||
// ============================================
|
||||
|
||||
Widget _buildTipsCard(_TransferColors c) {
|
||||
Widget _buildTipsCard() {
|
||||
final upColor = AppColorScheme.getUpColor(_isDark);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: c.profitGreenBg,
|
||||
color: AppColorScheme.getUpBackgroundColor(_isDark),
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(LucideIcons.info, size: 16, color: c.profitGreen),
|
||||
const SizedBox(width: 8),
|
||||
Icon(LucideIcons.info, size: 16, color: upColor),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'划转即时到账,无需手续费',
|
||||
style: _inter(fontSize: 12, fontWeight: FontWeight.normal, color: c.profitGreen),
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(color: upColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -444,7 +449,9 @@ class _TransferPageState extends State<TransferPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildConfirmButton(_TransferColors c) {
|
||||
Widget _buildConfirmButton() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
@@ -452,7 +459,7 @@ class _TransferPageState extends State<TransferPage> {
|
||||
onTap: _isLoading ? null : _doTransfer,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: c.accentPrimary,
|
||||
color: colorScheme.secondary,
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
),
|
||||
child: Center(
|
||||
@@ -462,12 +469,15 @@ class _TransferPageState extends State<TransferPage> {
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(c.textInverse),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(colorScheme.onSecondary),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'确认划转',
|
||||
style: _inter(fontSize: 16, fontWeight: FontWeight.w700, color: c.textInverse),
|
||||
style: AppTextStyles.displayMedium(context).copyWith(
|
||||
color: colorScheme.onSecondary,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -485,33 +495,3 @@ class _TransferPageState extends State<TransferPage> {
|
||||
return val.toStringAsFixed(2);
|
||||
}
|
||||
}
|
||||
|
||||
/// 主题感知颜色集合,避免在 build() 中重复定义大量局部变量
|
||||
class _TransferColors {
|
||||
final Color bgSecondary;
|
||||
final Color surfaceCard;
|
||||
final Color bgTertiary;
|
||||
final Color borderDefault;
|
||||
final Color textPrimary;
|
||||
final Color textSecondary;
|
||||
final Color textMuted;
|
||||
final Color textInverse;
|
||||
final Color accentPrimary;
|
||||
final Color goldAccent;
|
||||
final Color profitGreen;
|
||||
final Color profitGreenBg;
|
||||
|
||||
_TransferColors(bool isDark)
|
||||
: bgSecondary = isDark ? const Color(0xFF0B1120) : const Color(0xFFF8FAFC),
|
||||
surfaceCard = isDark ? const Color(0xFF0F172A) : const Color(0xFFFFFFFF),
|
||||
bgTertiary = isDark ? const Color(0xFF1E293B) : const Color(0xFFF1F5F9),
|
||||
borderDefault = isDark ? const Color(0xFF334155) : const Color(0xFFE2E8F0),
|
||||
textPrimary = isDark ? const Color(0xFFF8FAFC) : const Color(0xFF0F172A),
|
||||
textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF475569),
|
||||
textMuted = isDark ? const Color(0xFF64748B) : const Color(0xFF94A3B8),
|
||||
textInverse = isDark ? const Color(0xFF0F172A) : const Color(0xFFFFFFFF),
|
||||
accentPrimary = isDark ? const Color(0xFFD4AF37) : const Color(0xFF1F2937),
|
||||
goldAccent = isDark ? const Color(0xFFD4AF37) : const Color(0xFFF59E0B),
|
||||
profitGreen = isDark ? const Color(0xFF4ADE80) : const Color(0xFF16A34A),
|
||||
profitGreenBg = isDark ? const Color(0xFF052E16) : const Color(0xFFF0FDF4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user