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:
2026-04-05 23:37:27 +08:00
parent 189609f337
commit f5ac578892
39 changed files with 20289 additions and 1260 deletions

View File

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../providers/auth_provider.dart';
/// 首页顶栏 - Logo + 搜索/通知/头像
@@ -14,19 +16,17 @@ class HeaderBar extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
horizontal: AppSpacing.md,
vertical: AppSpacing.sm,
),
child: Row(
children: [
// Logo
Text(
'MONISUO',
style: GoogleFonts.inter(
style: AppTextStyles.headlineLarge(context).copyWith(
fontSize: 18,
fontWeight: FontWeight.w700,
letterSpacing: 1,
color: colorScheme.onSurface,
),
),
const Spacer(),
@@ -36,14 +36,14 @@ class HeaderBar extends StatelessWidget {
colorScheme: colorScheme,
onTap: () {},
),
const SizedBox(width: 8),
const SizedBox(width: AppSpacing.sm),
// Bell button
_IconButton(
icon: LucideIcons.bell,
colorScheme: colorScheme,
onTap: () {},
),
const SizedBox(width: 8),
const SizedBox(width: AppSpacing.sm),
// Avatar
Consumer<AuthProvider>(
builder: (context, auth, _) {
@@ -59,10 +59,8 @@ class HeaderBar extends StatelessWidget {
alignment: Alignment.center,
child: Text(
initial,
style: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.white,
style: AppTextStyles.headlineMedium(context).copyWith(
color: AppColorScheme.darkOnPrimary,
),
),
);
@@ -94,7 +92,7 @@ class _IconButton extends StatelessWidget {
height: 32,
decoration: BoxDecoration(
color: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(AppRadius.xl),
),
alignment: Alignment.center,
child: Icon(

View File

@@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:provider/provider.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 '../../../core/utils/toast_utils.dart';
@@ -170,19 +170,14 @@ class _HomePageState extends State<HomePage>
children: [
Text(
'充值',
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
SizedBox(height: AppSpacing.xs),
Text(
'资产: USDT',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.bodyMedium(context),
),
],
),
@@ -289,10 +284,8 @@ class _HomePageState extends State<HomePage>
SizedBox(width: AppSpacing.sm),
Text(
'充值申请成功',
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
],
@@ -304,7 +297,7 @@ class _HomePageState extends State<HomePage>
SizedBox(height: AppSpacing.lg),
Text(
'请向以下地址转账:',
style: TextStyle(fontSize: 12, color: colorScheme.onSurfaceVariant),
style: AppTextStyles.bodyMedium(context),
),
SizedBox(height: AppSpacing.sm),
_WalletAddressCard(address: walletAddress, network: walletNetwork),
@@ -323,7 +316,9 @@ class _HomePageState extends State<HomePage>
Expanded(
child: Text(
'转账完成后请点击"已打款"按钮确认',
style: TextStyle(fontSize: 12, color: AppColorScheme.warning),
style: AppTextStyles.bodyMedium(context).copyWith(
color: AppColorScheme.warning,
),
),
),
],
@@ -388,15 +383,13 @@ class _HomePageState extends State<HomePage>
mainAxisSize: MainAxisSize.min,
children: [
Text(title,
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
)),
if (message != null) ...[
SizedBox(height: AppSpacing.sm),
Text(message,
style: TextStyle(color: colorScheme.onSurfaceVariant),
style: AppTextStyles.bodyMedium(context),
textAlign: TextAlign.center),
],
SizedBox(height: AppSpacing.lg),
@@ -535,7 +528,7 @@ class _AssetCardState extends State<_AssetCard> {
final colorScheme = Theme.of(context).colorScheme;
final isDark = Theme.of(context).brightness == Brightness.dark;
final upColor = AppColorScheme.getUpColor(isDark);
final downColor = AppColorScheme.down;
final downColor = AppColorScheme.getDownColor(isDark);
final isProfit = _totalProfit >= 0;
final todayProfit = _todayProfit;
final isTodayProfit = (todayProfit ?? 0) >= 0;
@@ -555,10 +548,7 @@ class _AssetCardState extends State<_AssetCard> {
children: [
Text(
'预估总资产(USDT)',
style: TextStyle(
color: colorScheme.onSurfaceVariant,
fontSize: 12,
),
style: AppTextStyles.bodyMedium(context),
),
GestureDetector(
onTap: widget.onDeposit,
@@ -576,13 +566,11 @@ class _AssetCardState extends State<_AssetCard> {
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.add, size: 14, color: colorScheme.primary),
SizedBox(width: 4),
SizedBox(width: AppSpacing.xs),
Text(
'充值',
style: TextStyle(
style: AppTextStyles.labelLarge(context).copyWith(
color: colorScheme.primary,
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
@@ -596,10 +584,8 @@ class _AssetCardState extends State<_AssetCard> {
// 总资产金额
Text(
displayAsset,
style: GoogleFonts.spaceGrotesk(
fontSize: 22,
style: AppTextStyles.displaySmall(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
SizedBox(height: AppSpacing.md),
@@ -651,11 +637,10 @@ class _AssetCardState extends State<_AssetCard> {
? colorScheme.primary
: colorScheme.onSurfaceVariant,
),
SizedBox(width: 4),
SizedBox(width: AppSpacing.xs),
Text(
'盈亏分析',
style: TextStyle(
fontSize: 11,
style: AppTextStyles.labelMedium(context).copyWith(
fontWeight: _calendarExpanded ? FontWeight.w600 : FontWeight.w500,
color: _calendarExpanded
? colorScheme.primary
@@ -739,18 +724,15 @@ class _AssetCardState extends State<_AssetCard> {
children: [
Text(
'${_currentMonth.year}${_currentMonth.month}',
style: GoogleFonts.spaceGrotesk(
fontSize: 14,
style: AppTextStyles.headlineMedium(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
SizedBox(height: 2),
if (!_isLoadingCalendar && _profitData != null)
Text(
'月度盈亏: ${_monthProfit >= 0 ? '+' : ''}${_monthProfit.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 10,
style: AppTextStyles.bodySmall(context).copyWith(
fontWeight: FontWeight.w600,
color: _monthProfit >= 0 ? upColor : downColor,
),
@@ -787,10 +769,9 @@ class _AssetCardState extends State<_AssetCard> {
child: Center(
child: Text(
d,
style: TextStyle(
fontSize: 10,
color: colorScheme.onSurfaceVariant.withOpacity(0.6),
style: AppTextStyles.bodySmall(context).copyWith(
fontWeight: FontWeight.w500,
color: colorScheme.onSurfaceVariant.withOpacity(0.6),
),
),
),
@@ -866,7 +847,7 @@ class _AssetCardState extends State<_AssetCard> {
children: [
Text(
'$day',
style: TextStyle(
style: AppTextStyles.bodySmall(context).copyWith(
fontSize: 10,
fontWeight: isToday ? FontWeight.bold : FontWeight.w400,
color: isToday
@@ -969,10 +950,8 @@ class _WelfareCard extends StatelessWidget {
children: [
Text(
'福利中心',
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
SizedBox(height: AppSpacing.xs),
@@ -980,10 +959,7 @@ class _WelfareCard extends StatelessWidget {
totalClaimable > 0
? '您有 $totalClaimable 个奖励待领取'
: '首充奖励 + 推广奖励',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.bodyMedium(context),
),
],
),
@@ -1007,25 +983,24 @@ class _WelfareCard extends StatelessWidget {
Container(
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(10),
color: AppColorScheme.darkError,
borderRadius: BorderRadius.circular(AppRadius.md),
),
child: Text(
'$totalClaimable',
style: TextStyle(
color: Colors.white,
style: AppTextStyles.bodySmall(context).copyWith(
fontSize: 10,
fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnPrimary,
),
),
),
SizedBox(width: totalClaimable > 0 ? 6 : 0),
Text(
'查看',
style: TextStyle(
color: isDark ? colorScheme.background : Colors.white,
fontSize: 13,
style: AppTextStyles.headlineSmall(context).copyWith(
fontWeight: FontWeight.w700,
color: isDark ? colorScheme.background : AppColorScheme.darkOnPrimary,
),
),
],
@@ -1055,24 +1030,23 @@ class _HoldingsSection extends StatelessWidget {
children: [
Text(
'我的持仓',
style: TextStyle(
color: colorScheme.onSurface,
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
TextButton(
onPressed: () {},
style: TextButton.styleFrom(
foregroundColor: colorScheme.primary,
padding: const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.sm),
),
child: Row(
children: [
Text('资产详情',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13)),
const SizedBox(width: 4),
style: AppTextStyles.headlineSmall(context).copyWith(
fontWeight: FontWeight.bold,
)),
const SizedBox(width: AppSpacing.xs),
Icon(LucideIcons.chevronRight,
size: 16, color: colorScheme.primary),
],
@@ -1109,19 +1083,14 @@ class _EmptyHoldings extends StatelessWidget {
SizedBox(height: AppSpacing.md),
Text(
'暂无持仓',
style: TextStyle(
color: colorScheme.onSurface,
style: AppTextStyles.headlineMedium(context).copyWith(
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
SizedBox(height: AppSpacing.sm),
Text(
'快去交易吧~',
style: TextStyle(
color: colorScheme.onSurfaceVariant,
fontSize: 13,
),
style: AppTextStyles.bodyLarge(context),
),
],
),
@@ -1186,7 +1155,7 @@ class _HoldingItem extends StatelessWidget {
backgroundColor: colorScheme.primary.withOpacity(0.1),
child: Text(
holding.coinCode.substring(0, 1),
style: TextStyle(
style: AppTextStyles.headlineMedium(context).copyWith(
color: colorScheme.primary,
fontWeight: FontWeight.bold,
),
@@ -1197,16 +1166,11 @@ class _HoldingItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(holding.coinCode,
style: TextStyle(
color: colorScheme.onSurface,
style: AppTextStyles.headlineMedium(context).copyWith(
fontWeight: FontWeight.bold,
fontSize: 14,
)),
Text(holding.quantity,
style: TextStyle(
color: colorScheme.onSurfaceVariant,
fontSize: 12,
)),
style: AppTextStyles.bodyMedium(context)),
],
),
],
@@ -1215,18 +1179,14 @@ class _HoldingItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text('${holding.currentValue} USDT',
style: TextStyle(
color: colorScheme.onSurface,
style: AppTextStyles.headlineSmall(context).copyWith(
fontWeight: FontWeight.w500,
fontSize: 13,
)),
Text(holding.formattedProfitRate,
style: TextStyle(
style: AppTextStyles.numberSmall(context).copyWith(
color: holding.isProfit
? AppColorScheme.getUpColor(isDark)
: AppColorScheme.down,
fontSize: 12,
fontWeight: FontWeight.w500,
: AppColorScheme.getDownColor(isDark),
)),
],
),
@@ -1252,15 +1212,11 @@ class _InfoRow extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label,
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
)),
style: AppTextStyles.bodyMedium(context)),
Text(value,
style: GoogleFonts.spaceGrotesk(
fontSize: 12,
style: AppTextStyles.bodyMedium(context).copyWith(
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
color: colorScheme.onSurface,
fontFeatures: isBold ? const [FontFeature.tabularFigures()] : null,
)),
],
);
@@ -1293,10 +1249,8 @@ class _WalletAddressCard extends StatelessWidget {
Expanded(
child: Text(
address,
style: TextStyle(
style: AppTextStyles.bodyMedium(context).copyWith(
fontFamily: 'monospace',
fontSize: 12,
color: colorScheme.onSurface,
),
),
),
@@ -1320,10 +1274,7 @@ class _WalletAddressCard extends StatelessWidget {
SizedBox(height: AppSpacing.sm),
Text(
'网络: $network',
style: TextStyle(
fontSize: 11,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.bodySmall(context),
),
],
),
@@ -1380,10 +1331,9 @@ class _ProfitStatCard extends StatelessWidget {
SizedBox(width: 3),
Text(
label,
style: TextStyle(
fontSize: 10,
color: color.withOpacity(0.8),
style: AppTextStyles.bodySmall(context).copyWith(
fontWeight: FontWeight.w500,
color: color.withOpacity(0.8),
),
),
],
@@ -1393,8 +1343,7 @@ class _ProfitStatCard extends StatelessWidget {
hasValue
? '${isProfit ? '+' : ''}${value!.toStringAsFixed(2)}'
: '--',
style: GoogleFonts.spaceGrotesk(
fontSize: 14,
style: AppTextStyles.numberMedium(context).copyWith(
fontWeight: FontWeight.bold,
color: color,
),

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
@@ -17,29 +17,22 @@ class HotCoinsSection extends StatelessWidget {
children: [
// Title row
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'热门币种',
style: GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w600,
color: colorScheme.onSurface,
),
style: AppTextStyles.headlineLarge(context),
),
Text(
'更多',
style: GoogleFonts.inter(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.bodyMedium(context),
),
],
),
),
const SizedBox(height: 12),
const SizedBox(height: AppSpacing.sm + AppSpacing.xs),
// Card
Container(
decoration: BoxDecoration(
@@ -125,10 +118,10 @@ class _CoinRow extends StatelessWidget {
Widget build(BuildContext context) {
final changeColor = isUp
? AppColorScheme.getUpColor(isDark)
: AppColorScheme.down;
: AppColorScheme.getDownColor(isDark);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 16),
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: AppSpacing.md),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -140,31 +133,26 @@ class _CoinRow extends StatelessWidget {
backgroundColor: colorScheme.primary.withValues(alpha: 0.1),
child: Text(
symbol,
style: GoogleFonts.inter(
style: AppTextStyles.bodySmall(context).copyWith(
fontSize: 10,
fontWeight: FontWeight.w700,
color: colorScheme.primary,
),
),
),
const SizedBox(width: 12),
const SizedBox(width: AppSpacing.sm + AppSpacing.xs),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
pair,
style: GoogleFonts.inter(
fontSize: 14,
style: AppTextStyles.headlineMedium(context).copyWith(
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
Text(
fullName,
style: GoogleFonts.inter(
fontSize: 11,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.bodySmall(context),
),
],
),
@@ -176,17 +164,11 @@ class _CoinRow extends StatelessWidget {
children: [
Text(
price,
style: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w600,
color: colorScheme.onSurface,
),
style: AppTextStyles.numberMedium(context),
),
Text(
change,
style: GoogleFonts.inter(
fontSize: 11,
fontWeight: FontWeight.w500,
style: AppTextStyles.labelMedium(context).copyWith(
color: changeColor,
),
),

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_spacing.dart';
/// 首页快捷操作栏 - 充值/提现/划转/盈亏/账单
@@ -25,7 +25,7 @@ class QuickActionsRow extends StatelessWidget {
final colorScheme = Theme.of(context).colorScheme;
return Container(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
padding: const EdgeInsets.symmetric(vertical: AppSpacing.md, horizontal: AppSpacing.sm),
decoration: BoxDecoration(
color: colorScheme.surfaceContainer,
border: Border.all(
@@ -99,7 +99,7 @@ class _ActionItem extends StatelessWidget {
height: 40,
decoration: BoxDecoration(
color: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(AppRadius.md),
),
alignment: Alignment.center,
child: Icon(
@@ -108,14 +108,10 @@ class _ActionItem extends StatelessWidget {
color: colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 6),
const SizedBox(height: AppSpacing.xs + 2),
Text(
label,
style: GoogleFonts.inter(
fontSize: 11,
fontWeight: FontWeight.w500,
color: colorScheme.onSurfaceVariant,
),
style: AppTextStyles.labelMedium(context),
),
],
),