feat(ui): 底部导航栏添加文字标签

- 在图标下方添加文字标签(首页、行情、交易、资产、我的)
- 激活状态文字加粗
- 支持主题切换
- 提升用户体验和可识别性
This commit is contained in:
2026-03-24 02:55:55 +08:00
parent a65aa0fa86
commit a2be43bbf5
2 changed files with 68 additions and 42 deletions

View File

@@ -484,6 +484,7 @@ class _HoldingItem extends StatelessWidget {
void _showDepositDialog(BuildContext context) { void _showDepositDialog(BuildContext context) {
final amountController = TextEditingController(); final amountController = TextEditingController();
final formKey = GlobalKey<ShadFormState>(); final formKey = GlobalKey<ShadFormState>();
final colorScheme = Theme.of(context).colorScheme;
showShadDialog( showShadDialog(
context: context, context: context,
@@ -507,7 +508,7 @@ void _showDepositDialog(BuildContext context) {
style: GoogleFonts.spaceGrotesk( style: GoogleFonts.spaceGrotesk(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
SizedBox(height: AppSpacing.xs), SizedBox(height: AppSpacing.xs),
@@ -516,7 +517,7 @@ void _showDepositDialog(BuildContext context) {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
letterSpacing: 0.1, letterSpacing: 0.1,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
], ],
@@ -524,12 +525,12 @@ void _showDepositDialog(BuildContext context) {
Container( Container(
padding: EdgeInsets.all(AppSpacing.sm), padding: EdgeInsets.all(AppSpacing.sm),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.darkSurfaceContainerHigh, color: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.md), borderRadius: BorderRadius.circular(AppRadius.md),
), ),
child: Icon( child: Icon(
LucideIcons.wallet, LucideIcons.wallet,
color: AppColorScheme.darkSecondary, color: colorScheme.secondary,
), ),
), ),
], ],
@@ -596,6 +597,7 @@ void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
final amount = data['amount']?.toString() ?? '0.00'; final amount = data['amount']?.toString() ?? '0.00';
final walletAddress = data['walletAddress'] as String? ?? ''; final walletAddress = data['walletAddress'] as String? ?? '';
final walletNetwork = data['walletNetwork'] as String? ?? 'TRC20'; final walletNetwork = data['walletNetwork'] as String? ?? 'TRC20';
final colorScheme = Theme.of(context).colorScheme;
showShadDialog( showShadDialog(
context: context, context: context,
@@ -612,7 +614,7 @@ void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
children: [ children: [
NeonIcon( NeonIcon(
icon: Icons.check_circle, icon: Icons.check_circle,
color: AppColorScheme.darkTertiary, color: AppColorScheme.up,
size: 24, size: 24,
), ),
SizedBox(width: AppSpacing.sm), SizedBox(width: AppSpacing.sm),
@@ -621,7 +623,7 @@ void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
style: GoogleFonts.spaceGrotesk( style: GoogleFonts.spaceGrotesk(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
], ],
@@ -635,7 +637,7 @@ void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
'请向以下地址转账:', '请向以下地址转账:',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
SizedBox(height: AppSpacing.sm), SizedBox(height: AppSpacing.sm),
@@ -644,10 +646,10 @@ void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
Container( Container(
padding: EdgeInsets.all(AppSpacing.sm), padding: EdgeInsets.all(AppSpacing.sm),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.warning.withValues(alpha: 0.1), color: AppColorScheme.warning.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.md), borderRadius: BorderRadius.circular(AppRadius.md),
border: Border.all( border: Border.all(
color: AppColorScheme.warning.withValues(alpha: 0.2), color: AppColorScheme.warning.withOpacity(0.2),
), ),
), ),
child: Row( child: Row(
@@ -713,6 +715,8 @@ class _InfoRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@@ -720,7 +724,7 @@ class _InfoRow extends StatelessWidget {
label, label,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
Text( Text(
@@ -728,7 +732,7 @@ class _InfoRow extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: isBold ? FontWeight.bold : FontWeight.normal, fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
], ],
@@ -744,13 +748,15 @@ class _WalletAddressCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Container( return Container(
padding: EdgeInsets.all(AppSpacing.md), padding: EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.darkSurfaceContainerHigh, color: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.md), borderRadius: BorderRadius.circular(AppRadius.md),
border: Border.all( border: Border.all(
color: AppColorScheme.darkOutlineVariant.withValues(alpha: 0.3), color: colorScheme.outlineVariant.withOpacity(0.3),
), ),
), ),
child: Column( child: Column(
@@ -761,10 +767,10 @@ class _WalletAddressCard extends StatelessWidget {
Expanded( Expanded(
child: Text( child: Text(
address, address,
style: const TextStyle( style: TextStyle(
fontFamily: 'monospace', fontFamily: 'monospace',
fontSize: 12, fontSize: 12,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
), ),
@@ -778,13 +784,13 @@ class _WalletAddressCard extends StatelessWidget {
child: Container( child: Container(
padding: EdgeInsets.all(AppSpacing.xs), padding: EdgeInsets.all(AppSpacing.xs),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.darkPrimary.withValues(alpha: 0.1), color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm), borderRadius: BorderRadius.circular(AppRadius.sm),
), ),
child: Icon( child: Icon(
LucideIcons.copy, LucideIcons.copy,
size: 16, size: 16,
color: AppColorScheme.darkPrimary, color: colorScheme.primary,
), ),
), ),
), ),
@@ -795,7 +801,7 @@ class _WalletAddressCard extends StatelessWidget {
'网络: $network', '网络: $network',
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
], ],
@@ -809,6 +815,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
final addressController = TextEditingController(); final addressController = TextEditingController();
final contactController = TextEditingController(); final contactController = TextEditingController();
final formKey = GlobalKey<ShadFormState>(); final formKey = GlobalKey<ShadFormState>();
final colorScheme = Theme.of(context).colorScheme;
showShadDialog( showShadDialog(
context: context, context: context,
@@ -827,12 +834,12 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
Container( Container(
padding: EdgeInsets.all(AppSpacing.sm), padding: EdgeInsets.all(AppSpacing.sm),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.darkPrimary.withValues(alpha: 0.1), color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.md), borderRadius: BorderRadius.circular(AppRadius.md),
), ),
child: Icon( child: Icon(
LucideIcons.wallet, LucideIcons.wallet,
color: AppColorScheme.darkPrimary, color: colorScheme.primary,
), ),
), ),
SizedBox(width: AppSpacing.sm), SizedBox(width: AppSpacing.sm),
@@ -841,7 +848,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
style: GoogleFonts.spaceGrotesk( style: GoogleFonts.spaceGrotesk(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
], ],
@@ -851,7 +858,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
'Securely transfer your assets to an external wallet address.', 'Securely transfer your assets to an external wallet address.',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
if (balance != null) ...[ if (balance != null) ...[
@@ -862,10 +869,10 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
vertical: AppSpacing.sm, vertical: AppSpacing.sm,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.darkTertiary.withValues(alpha: 0.1), color: AppColorScheme.up.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.full), borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all( border: Border.all(
color: AppColorScheme.darkTertiary.withValues(alpha: 0.2), color: AppColorScheme.up.withOpacity(0.2),
), ),
), ),
child: Row( child: Row(
@@ -876,7 +883,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
letterSpacing: 0.1, letterSpacing: 0.1,
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
Text( Text(
@@ -884,7 +891,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkTertiary, color: AppColorScheme.up,
), ),
), ),
], ],
@@ -971,7 +978,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
Icon( Icon(
Icons.verified_user, Icons.verified_user,
size: 12, size: 12,
color: AppColorScheme.darkOnSurfaceVariant.withValues(alpha: 0.5), color: colorScheme.onSurfaceVariant.withOpacity(0.5),
), ),
SizedBox(width: AppSpacing.xs), SizedBox(width: AppSpacing.xs),
Text( Text(
@@ -979,7 +986,7 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
letterSpacing: 0.1, letterSpacing: 0.1,
color: AppColorScheme.darkOnSurfaceVariant.withValues(alpha: 0.5), color: colorScheme.onSurfaceVariant.withOpacity(0.5),
), ),
), ),
], ],
@@ -996,6 +1003,7 @@ void _showTransferDialog(BuildContext context) {
final controller = TextEditingController(); final controller = TextEditingController();
final formKey = GlobalKey<ShadFormState>(); final formKey = GlobalKey<ShadFormState>();
int direction = 1; int direction = 1;
final colorScheme = Theme.of(context).colorScheme;
showShadDialog( showShadDialog(
context: context, context: context,
@@ -1014,7 +1022,7 @@ void _showTransferDialog(BuildContext context) {
style: GoogleFonts.spaceGrotesk( style: GoogleFonts.spaceGrotesk(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
SizedBox(height: AppSpacing.lg), SizedBox(height: AppSpacing.lg),
@@ -1109,6 +1117,8 @@ class _DirectionButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,
child: AnimatedContainer( child: AnimatedContainer(
@@ -1116,12 +1126,12 @@ class _DirectionButton extends StatelessWidget {
padding: EdgeInsets.symmetric(vertical: AppSpacing.sm + AppSpacing.xs), padding: EdgeInsets.symmetric(vertical: AppSpacing.sm + AppSpacing.xs),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: isSelected
? AppColorScheme.darkPrimary.withValues(alpha: 0.15) ? colorScheme.primary.withOpacity(0.15)
: AppColorScheme.darkSurfaceContainerHigh, : colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.md), borderRadius: BorderRadius.circular(AppRadius.md),
border: isSelected border: isSelected
? Border.all( ? Border.all(
color: AppColorScheme.darkPrimary.withValues(alpha: 0.3), color: colorScheme.primary.withOpacity(0.3),
) )
: null, : null,
), ),
@@ -1133,7 +1143,7 @@ class _DirectionButton extends StatelessWidget {
Icon( Icon(
LucideIcons.check, LucideIcons.check,
size: 14, size: 14,
color: AppColorScheme.darkPrimary, color: colorScheme.primary,
) )
else else
SizedBox(width: 14), SizedBox(width: 14),
@@ -1142,8 +1152,8 @@ class _DirectionButton extends StatelessWidget {
label, label,
style: TextStyle( style: TextStyle(
color: isSelected color: isSelected
? AppColorScheme.darkPrimary ? colorScheme.primary
: AppColorScheme.darkOnSurfaceVariant, : colorScheme.onSurfaceVariant,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal, fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
fontSize: 12, fontSize: 12,
), ),
@@ -1157,6 +1167,8 @@ class _DirectionButton extends StatelessWidget {
} }
void _showResultDialog(BuildContext context, String title, String? message) { void _showResultDialog(BuildContext context, String title, String? message) {
final colorScheme = Theme.of(context).colorScheme;
showShadDialog( showShadDialog(
context: context, context: context,
builder: (ctx) => Dialog( builder: (ctx) => Dialog(
@@ -1172,7 +1184,7 @@ void _showResultDialog(BuildContext context, String title, String? message) {
style: GoogleFonts.spaceGrotesk( style: GoogleFonts.spaceGrotesk(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnSurface, color: colorScheme.onSurface,
), ),
), ),
if (message != null) ...[ if (message != null) ...[
@@ -1180,7 +1192,7 @@ void _showResultDialog(BuildContext context, String title, String? message) {
Text( Text(
message, message,
style: TextStyle( style: TextStyle(
color: AppColorScheme.darkOnSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),

View File

@@ -273,7 +273,7 @@ class _NavItemWidget extends StatelessWidget {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
padding: const EdgeInsets.all(12), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: isSelected decoration: isSelected
? BoxDecoration( ? BoxDecoration(
color: colorScheme.primary.withOpacity(0.1), color: colorScheme.primary.withOpacity(0.1),
@@ -287,11 +287,25 @@ class _NavItemWidget extends StatelessWidget {
], ],
) )
: null, : null,
child: Icon( child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
item.icon, item.icon,
color: color, color: color,
size: 24, size: 24,
), ),
const SizedBox(height: 4),
Text(
item.label,
style: TextStyle(
color: color,
fontSize: 12,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
),
),
],
),
), ),
); );
} }