fix: 优化充值提现和划转界面

- 充值提现弹框: 去掉透明效果,改为实心背景,确保可读性
- 划转界面: 重构为币安风格,账户选择更清晰,交互更自然
- 交易界面: 充值/提现/划转按钮去掉图标,只保留文字
- 整体提升专业金融感
This commit is contained in:
2026-03-30 03:49:31 +08:00
parent 8825fe5b27
commit 9f56be7450
87 changed files with 39348 additions and 39526 deletions

View File

@@ -1,12 +1,10 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import '../../core/theme/app_color_scheme.dart';
import '../../core/theme/app_spacing.dart';
/// GlassPanel - 毛玻璃效果面板
/// GlassPanel - 实心背景面板
///
/// Material Design 3 风格的毛玻璃效果组件
/// 用于卡片、弹窗、底部抽屉等需要毛玻璃效果的容器
/// Material Design 3 风格的实心背景容器
/// 用于卡片、弹窗、底部抽屉等需要清晰背景的容器
///
/// 示例:
/// ```dart
@@ -18,13 +16,10 @@ class GlassPanel extends StatelessWidget {
/// 子组件
final Widget child;
/// 模糊程度,默认 20.0
final double blur;
/// 背景色,默认使用 GlassPanel 背景色
/// 背景色,默认使用 surfaceContainer
final Color? backgroundColor;
/// 边框色,默认使用 GlassPanel 边框色
/// 边框色
final Color? borderColor;
/// 圆角,默认特大圆角
@@ -48,7 +43,6 @@ class GlassPanel extends StatelessWidget {
const GlassPanel({
super.key,
required this.child,
this.blur = 20.0,
this.backgroundColor,
this.borderColor,
this.borderRadius,
@@ -64,32 +58,25 @@ class GlassPanel extends StatelessWidget {
final colorScheme = Theme.of(context).colorScheme;
final isDark = Theme.of(context).brightness == Brightness.dark;
final bgColor = backgroundColor ??
colorScheme.surfaceBright.withOpacity(isDark ? 0.4 : 0.6);
final brColor = borderColor ??
colorScheme.outlineVariant.withOpacity(0.15);
(isDark ? colorScheme.surfaceContainer : colorScheme.surfaceContainerHigh);
final brColor = borderColor ?? colorScheme.outlineVariant.withOpacity(0.15);
final br = borderRadius ?? BorderRadius.circular(AppRadius.xl);
Widget content = ClipRRect(
borderRadius: br,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
child: Container(
width: width,
height: height,
padding: padding ?? EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: bgColor,
borderRadius: br,
border: showBorder
? Border.all(
color: brColor,
width: 1,
)
: null,
),
child: child,
),
Widget content = Container(
width: width,
height: height,
padding: padding ?? EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: bgColor,
borderRadius: br,
border: showBorder
? Border.all(
color: brColor,
width: 1,
)
: null,
),
child: child,
);
if (margin != null) {
@@ -103,7 +90,7 @@ class GlassPanel extends StatelessWidget {
}
}
/// GlassCard - 带毛玻璃效果的卡片
/// GlassCard - 带实心背景的卡片
///
/// 用于列表项、信息展示等场景
/// 预设了常用配置,简化使用
@@ -187,7 +174,7 @@ class GlassCard extends StatelessWidget {
}
}
/// GlassBottomSheet - 毛玻璃底部抽屉
/// GlassBottomSheet - 实心背景底部抽屉
///
/// 用于弹出的底部面板
class GlassBottomSheet extends StatelessWidget {
@@ -218,7 +205,7 @@ class GlassBottomSheet extends StatelessWidget {
return Container(
decoration: BoxDecoration(
color: colorScheme.surfaceBright.withOpacity(isDark ? 0.4 : 0.6),
color: isDark ? colorScheme.surfaceContainer : colorScheme.surfaceContainerHigh,
borderRadius: const BorderRadius.vertical(
top: Radius.circular(AppRadius.xxl),
),
@@ -226,81 +213,73 @@ class GlassBottomSheet extends StatelessWidget {
color: colorScheme.outlineVariant.withOpacity(0.15),
),
),
child: ClipRRect(
borderRadius: const BorderRadius.vertical(
top: Radius.circular(AppRadius.xxl),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 顶部拖动条
Container(
margin: const EdgeInsets.only(top: 12, bottom: 8),
width: 40,
height: 4,
decoration: BoxDecoration(
color: colorScheme.outlineVariant.withOpacity(0.5),
borderRadius: BorderRadius.circular(2),
),
),
// 标题栏
if (title != null || showCloseButton)
Padding(
padding: EdgeInsets.fromLTRB(
AppSpacing.lg,
AppSpacing.sm,
AppSpacing.sm,
AppSpacing.md,
),
child: Row(
children: [
if (title != null)
Expanded(
child: Text(
title!,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
),
if (showCloseButton)
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
padding: EdgeInsets.all(AppSpacing.sm),
decoration: BoxDecoration(
color: colorScheme.outlineVariant
.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(
Icons.close,
size: 18,
color: colorScheme.onSurfaceVariant,
),
),
),
],
),
),
// 内容
Padding(
padding: padding ??
EdgeInsets.fromLTRB(
AppSpacing.lg,
0,
AppSpacing.lg,
AppSpacing.xl,
),
child: child,
),
],
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 顶部拖动条
Container(
margin: const EdgeInsets.only(top: 12, bottom: 8),
width: 40,
height: 4,
decoration: BoxDecoration(
color: colorScheme.outlineVariant.withOpacity(0.5),
borderRadius: BorderRadius.circular(2),
),
),
),
// 标题栏
if (title != null || showCloseButton)
Padding(
padding: EdgeInsets.fromLTRB(
AppSpacing.lg,
AppSpacing.sm,
AppSpacing.sm,
AppSpacing.md,
),
child: Row(
children: [
if (title != null)
Expanded(
child: Text(
title!,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
),
if (showCloseButton)
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
padding: EdgeInsets.all(AppSpacing.sm),
decoration: BoxDecoration(
color: colorScheme.outlineVariant
.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(
Icons.close,
size: 18,
color: colorScheme.onSurfaceVariant,
),
),
),
],
),
),
// 内容
Padding(
padding: padding ??
EdgeInsets.fromLTRB(
AppSpacing.lg,
0,
AppSpacing.lg,
AppSpacing.xl,
),
child: child,
),
],
),
);
}

View File

@@ -294,7 +294,6 @@ class _FundAccountCard extends StatelessWidget {
child: NeonButton(
text: '充值',
type: NeonButtonType.tertiary,
icon: Icons.add,
onPressed: () => _showDepositDialog(context),
height: 44,
showGlow: false,
@@ -305,7 +304,6 @@ class _FundAccountCard extends StatelessWidget {
child: NeonButton(
text: '提现',
type: NeonButtonType.secondary,
icon: Icons.remove,
onPressed: () => _showWithdrawDialog(context, fund?.balance),
height: 44,
showGlow: false,
@@ -316,7 +314,6 @@ class _FundAccountCard extends StatelessWidget {
child: NeonButton(
text: '划转',
type: NeonButtonType.outline,
icon: Icons.swap_horiz,
onPressed: () => _navigateToTransfer(context),
height: 44,
showGlow: false,

View File

@@ -8,10 +8,9 @@ import '../../../core/theme/app_spacing.dart';
import '../../../providers/asset_provider.dart';
import '../../../data/models/account_models.dart';
import '../../shared/ui_constants.dart';
import '../../components/glass_panel.dart';
import '../../components/neon_glow.dart';
/// 划转页面 - 资金账户与交易账户互相划转
/// 划转页面 - 币安风格
class TransferPage extends StatefulWidget {
const TransferPage({super.key});
@@ -21,7 +20,6 @@ class TransferPage extends StatefulWidget {
class _TransferPageState extends State<TransferPage> {
final _amountController = TextEditingController();
final _formKey = GlobalKey<ShadFormState>();
int _direction = 1; // 1: 资金→交易, 2: 交易→资金
bool _isLoading = false;
@@ -70,10 +68,14 @@ class _TransferPageState extends State<TransferPage> {
return _direction == 1 ? _fundBalance : _tradeUsdtBalance;
}
/// 从账户名
String get _fromLabel => _direction == 1 ? '资金账户' : '交易账户';
String get _toLabel => _direction == 1 ? '交易账户' : '资金账户';
String get _fromBalance => _direction == 1 ? _fundBalance : _tradeUsdtBalance;
String get _toBalance => _direction == 1 ? _tradeUsdtBalance : _fundBalance;
/// 执行划转
Future<void> _doTransfer() async {
if (!_formKey.currentState!.saveAndValidate()) return;
final amount = _amountController.text;
final available = double.tryParse(_availableBalance) ?? 0;
final transferAmount = double.tryParse(amount) ?? 0;
@@ -100,7 +102,7 @@ class _TransferPageState extends State<TransferPage> {
if (response.success) {
_amountController.clear();
_showSnackBar('划转成功');
Navigator.of(context).pop(true); // 返回成功标记
Navigator.of(context).pop(true);
} else {
_showSnackBar(response.message ?? '划转失败');
}
@@ -118,6 +120,14 @@ class _TransferPageState extends State<TransferPage> {
);
}
/// 设置快捷百分比金额
void _setQuickAmount(double percent) {
final available = double.tryParse(_availableBalance) ?? 0;
final amount = available * percent;
// 保留8位小数去除末尾0
_amountController.text = amount.toStringAsFixed(8).replaceAll(RegExp(r'\.?0+$'), '');
}
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
@@ -147,30 +157,71 @@ class _TransferPageState extends State<TransferPage> {
return SingleChildScrollView(
padding: AppSpacing.pagePadding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 说明卡片
_buildInfoCard(colorScheme),
// 从账户卡片
_buildAccountCard(
label: '',
accountName: _fromLabel,
balance: _fromBalance,
isDark: isDark,
colorScheme: colorScheme,
),
// 方向切换按钮
GestureDetector(
onTap: () => setState(() => _direction = _direction == 1 ? 2 : 1),
child: Container(
margin: EdgeInsets.symmetric(vertical: AppSpacing.sm),
padding: EdgeInsets.all(AppSpacing.sm + AppSpacing.xs),
decoration: BoxDecoration(
color: colorScheme.primary,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: colorScheme.primary.withOpacity(0.3),
blurRadius: 8,
),
],
),
child: Icon(
Icons.swap_vert,
color: colorScheme.onPrimary,
size: 22,
),
),
),
// 到账户卡片
_buildAccountCard(
label: '',
accountName: _toLabel,
balance: _toBalance,
isDark: isDark,
colorScheme: colorScheme,
),
SizedBox(height: AppSpacing.lg),
// 划转方向选择
_buildDirectionSelector(colorScheme),
SizedBox(height: AppSpacing.lg),
// 金额输入卡片
_buildAmountSection(colorScheme, isDark),
// 账户余额显示
_buildBalanceCards(provider, colorScheme, isDark),
SizedBox(height: AppSpacing.lg),
// 金额输入
_buildAmountInput(colorScheme),
SizedBox(height: AppSpacing.xl),
// 确认按钮
_buildSubmitButton(colorScheme),
SizedBox(
width: double.infinity,
child: NeonButton(
text: _isLoading ? '处理中...' : '确认划转',
type: NeonButtonType.primary,
onPressed: _isLoading ? null : _doTransfer,
height: 52,
showGlow: true,
),
),
SizedBox(height: AppSpacing.lg),
SizedBox(height: AppSpacing.md),
// 提示信息
// 划转说明
_buildTips(colorScheme),
],
),
@@ -180,80 +231,167 @@ class _TransferPageState extends State<TransferPage> {
);
}
/// 说明卡片
Widget _buildInfoCard(ColorScheme colorScheme) {
/// 账户卡片
Widget _buildAccountCard({
required String label,
required String accountName,
required String balance,
required bool isDark,
required ColorScheme colorScheme,
}) {
return Container(
width: double.infinity,
padding: EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.md),
color: isDark ? colorScheme.surfaceContainer : colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(
color: colorScheme.primary.withOpacity(0.2),
color: colorScheme.outlineVariant.withOpacity(0.15),
),
),
child: Row(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
LucideIcons.info,
size: 18,
color: colorScheme.primary,
),
SizedBox(width: AppSpacing.sm),
Expanded(
child: Text(
_direction == 1
? '资金账户 → 交易账户:相当于用资金账户的钱购买 USDT'
: '交易账户 → 资金账户:相当于卖掉 USDT 换回资金',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
Row(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: AppSpacing.sm, vertical: AppSpacing.xs),
decoration: BoxDecoration(
color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: colorScheme.primary,
),
),
),
),
SizedBox(width: AppSpacing.sm),
Text(
accountName,
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
fontWeight: FontWeight.w600,
color: colorScheme.onSurface,
),
),
],
),
SizedBox(height: AppSpacing.sm),
Row(
children: [
Text(
'可用余额',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
),
SizedBox(width: AppSpacing.xs),
Text(
'$balance USDT',
style: GoogleFonts.spaceGrotesk(
fontSize: 14,
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
),
],
),
],
),
);
}
/// 划转方向选择器
Widget _buildDirectionSelector(ColorScheme colorScheme) {
return GlassPanel(
/// 金额输入区域
Widget _buildAmountSection(ColorScheme colorScheme, bool isDark) {
return Container(
width: double.infinity,
padding: EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: isDark ? colorScheme.surfaceContainer : colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(
color: colorScheme.outlineVariant.withOpacity(0.15),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'划转方向',
style: GoogleFonts.spaceGrotesk(
fontSize: 14,
fontWeight: FontWeight.w600,
color: colorScheme.onSurface,
'划转金额',
style: TextStyle(
fontSize: 13,
color: colorScheme.onSurfaceVariant,
),
),
SizedBox(height: AppSpacing.md),
SizedBox(height: AppSpacing.sm),
// 金额输入行
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: _DirectionCard(
title: '资金账户',
subtitle: '交易账户',
icon: LucideIcons.arrowRight,
isSelected: _direction == 1,
onTap: () => setState(() => _direction = 1),
child: TextField(
controller: _amountController,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,8}')),
],
style: GoogleFonts.spaceGrotesk(
fontSize: 32,
fontWeight: FontWeight.bold,
color: colorScheme.onSurface,
),
decoration: InputDecoration(
hintText: '0.00',
hintStyle: GoogleFonts.spaceGrotesk(
fontSize: 32,
fontWeight: FontWeight.bold,
color: colorScheme.onSurfaceVariant.withOpacity(0.3),
),
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
isDense: true,
),
),
),
SizedBox(width: AppSpacing.sm),
Expanded(
child: _DirectionCard(
title: '交易账户',
subtitle: '资金账户',
icon: LucideIcons.arrowRight,
isSelected: _direction == 2,
onTap: () => setState(() => _direction = 2),
Padding(
padding: EdgeInsets.only(bottom: 4),
child: Text(
'USDT',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: colorScheme.onSurfaceVariant,
),
),
),
],
),
SizedBox(height: AppSpacing.sm),
// 快捷按钮行
Row(
children: [
Text(
'可用: ${_availableBalance}',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
),
Spacer(),
_buildQuickButton('25%', 0.25, colorScheme),
SizedBox(width: AppSpacing.xs),
_buildQuickButton('50%', 0.50, colorScheme),
SizedBox(width: AppSpacing.xs),
_buildQuickButton('75%', 0.75, colorScheme),
SizedBox(width: AppSpacing.xs),
_buildQuickButton('全部', 1.0, colorScheme),
],
),
if (_direction == 2) ...[
SizedBox(height: AppSpacing.sm),
Container(
@@ -288,149 +426,29 @@ class _TransferPageState extends State<TransferPage> {
);
}
/// 账户余额卡片
Widget _buildBalanceCards(AssetProvider provider, ColorScheme colorScheme, bool isDark) {
final fundBalance = provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00';
final tradeUsdtBalance = _tradeUsdtBalance;
return Row(
children: [
Expanded(
child: _BalanceCard(
title: '资金账户',
balance: fundBalance,
isActive: _direction == 1,
colorScheme: colorScheme,
),
/// 快捷百分比按钮
Widget _buildQuickButton(String label, double percent, ColorScheme colorScheme) {
return GestureDetector(
onTap: () => _setQuickAmount(percent),
child: Container(
padding: EdgeInsets.symmetric(horizontal: AppSpacing.sm, vertical: AppSpacing.xs),
decoration: BoxDecoration(
color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
SizedBox(width: AppSpacing.sm),
// 中间的转换图标
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: colorScheme.primary.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
_direction == 1 ? LucideIcons.arrowRight : LucideIcons.arrowLeft,
child: Text(
label,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: colorScheme.primary,
size: 18,
),
),
SizedBox(width: AppSpacing.sm),
Expanded(
child: _BalanceCard(
title: '交易账户(USDT)',
balance: tradeUsdtBalance,
isActive: _direction == 2,
colorScheme: colorScheme,
),
),
],
);
}
/// 金额输入
Widget _buildAmountInput(ColorScheme colorScheme) {
final available = _availableBalance;
return GlassPanel(
padding: EdgeInsets.all(AppSpacing.md),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'划转金额',
style: GoogleFonts.spaceGrotesk(
fontSize: 14,
fontWeight: FontWeight.w600,
color: colorScheme.onSurface,
),
),
GestureDetector(
onTap: () {
_amountController.text = available;
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: AppSpacing.sm,
vertical: AppSpacing.xs,
),
decoration: BoxDecoration(
color: colorScheme.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
'全部',
style: TextStyle(
fontSize: 12,
color: colorScheme.primary,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
SizedBox(height: AppSpacing.sm),
Text(
'可用: $available USDT',
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
),
SizedBox(height: AppSpacing.md),
ShadForm(
key: _formKey,
child: ShadInputFormField(
id: 'amount',
controller: _amountController,
placeholder: const Text('请输入划转金额'),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,8}')),
],
validator: (value) {
if (value == null || value.isEmpty) {
return '请输入划转金额';
}
final amount = double.tryParse(value);
if (amount == null || amount <= 0) {
return '请输入有效金额';
}
final available = double.tryParse(_availableBalance) ?? 0;
if (amount > available) {
return '余额不足';
}
return null;
},
),
),
],
),
);
}
/// 提交按钮
Widget _buildSubmitButton(ColorScheme colorScheme) {
return SizedBox(
width: double.infinity,
child: NeonButton(
text: _isLoading ? '处理中...' : '确认划转',
type: NeonButtonType.primary,
onPressed: _isLoading ? null : _doTransfer,
height: 52,
showGlow: true,
),
);
}
/// 提示信息
/// 划转说明
Widget _buildTips(ColorScheme colorScheme) {
return Container(
padding: EdgeInsets.all(AppSpacing.md),
@@ -488,141 +506,3 @@ class _TransferPageState extends State<TransferPage> {
);
}
}
/// 方向选择卡片
class _DirectionCard extends StatelessWidget {
final String title;
final String subtitle;
final IconData icon;
final bool isSelected;
final VoidCallback onTap;
const _DirectionCard({
required this.title,
required this.subtitle,
required this.icon,
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return GestureDetector(
onTap: onTap,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: isSelected
? colorScheme.primary.withOpacity(0.15)
: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.md),
border: isSelected
? Border.all(color: colorScheme.primary.withOpacity(0.5))
: null,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
style: TextStyle(
fontSize: 11,
color: colorScheme.onSurfaceVariant,
),
),
SizedBox(width: AppSpacing.xs),
Icon(
icon,
size: 12,
color: colorScheme.onSurfaceVariant,
),
SizedBox(width: AppSpacing.xs),
Text(
subtitle,
style: TextStyle(
fontSize: 11,
color: isSelected ? colorScheme.primary : colorScheme.onSurfaceVariant,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
),
),
],
),
if (isSelected) ...[
SizedBox(height: AppSpacing.xs),
Icon(
LucideIcons.check,
size: 14,
color: colorScheme.primary,
),
],
],
),
),
);
}
}
/// 余额卡片
class _BalanceCard extends StatelessWidget {
final String title;
final String balance;
final bool isActive;
final ColorScheme colorScheme;
const _BalanceCard({
required this.title,
required this.balance,
required this.isActive,
required this.colorScheme,
});
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: isActive
? colorScheme.primary.withOpacity(0.1)
: colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.md),
border: isActive
? Border.all(color: colorScheme.primary.withOpacity(0.3))
: null,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 10,
color: colorScheme.onSurfaceVariant,
),
),
SizedBox(height: AppSpacing.xs),
Text(
balance,
style: GoogleFonts.spaceGrotesk(
fontSize: 16,
fontWeight: FontWeight.bold,
color: isActive ? colorScheme.primary : colorScheme.onSurface,
),
),
Text(
'USDT',
style: TextStyle(
fontSize: 10,
color: colorScheme.onSurfaceVariant,
),
),
],
),
);
}
}