fix: 优化充值提现和划转界面
- 充值提现弹框: 去掉透明效果,改为实心背景,确保可读性 - 划转界面: 重构为币安风格,账户选择更清晰,交互更自然 - 交易界面: 充值/提现/划转按钮去掉图标,只保留文字 - 整体提升专业金融感
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user