Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -88,7 +88,6 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
children: [
|
||||
Expanded(
|
||||
child: BalanceCard(
|
||||
provider: provider,
|
||||
label: '资金账户',
|
||||
balance: provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00',
|
||||
),
|
||||
@@ -96,7 +95,6 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: BalanceCard(
|
||||
provider: provider,
|
||||
label: '交易账户',
|
||||
balance: _calculateTradeTotal(provider),
|
||||
),
|
||||
|
||||
@@ -2,18 +2,15 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../providers/asset_provider.dart';
|
||||
import '../../../components/glass_panel.dart';
|
||||
|
||||
/// 余额卡片 — 显示单个账户的 USDT 余额
|
||||
class BalanceCard extends StatelessWidget {
|
||||
final AssetProvider provider;
|
||||
final String label;
|
||||
final String balance;
|
||||
|
||||
const BalanceCard({
|
||||
super.key,
|
||||
required this.provider,
|
||||
required this.label,
|
||||
required this.balance,
|
||||
});
|
||||
@@ -22,33 +19,36 @@ class BalanceCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final displayBalance = balance;
|
||||
|
||||
return GlassPanel(
|
||||
padding: const EdgeInsets.all(20),
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w400,
|
||||
return SizedBox(
|
||||
width: double.infinity, // 确保卡片撑满宽度
|
||||
child: GlassPanel(
|
||||
padding: const EdgeInsets.all(20),
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_formatBalance(displayBalance),
|
||||
style: AppTextStyles.numberLarge(context),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'\u2248 \$${_formatBalance(displayBalance)} USD',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.appColors.onSurfaceMuted,
|
||||
fontWeight: FontWeight.w400,
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_formatBalance(displayBalance),
|
||||
style: AppTextStyles.numberLarge(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'\u2248 \$${_formatBalance(displayBalance)} USD',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.appColors.onSurfaceMuted,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,19 +10,16 @@ import '../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../core/utils/toast_utils.dart';
|
||||
import '../../../core/event/app_event_bus.dart';
|
||||
import '../../../data/models/account_models.dart';
|
||||
import '../../../data/services/asset_service.dart';
|
||||
import '../../../data/services/bonus_service.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import '../../components/glass_panel.dart';
|
||||
import '../../components/neon_glow.dart';
|
||||
import '../asset/transfer_page.dart';
|
||||
import '../asset/components/asset_dialogs.dart';
|
||||
import '../main/main_page.dart';
|
||||
import '../mine/welfare_center_page.dart';
|
||||
import 'header_bar.dart';
|
||||
import 'profit_analysis_page.dart';
|
||||
import 'bills_page.dart';
|
||||
import 'quick_actions_row.dart';
|
||||
import 'hot_coins_section.dart';
|
||||
import 'profit_analysis_page.dart';
|
||||
|
||||
/// 首页
|
||||
class HomePage extends StatefulWidget {
|
||||
@@ -112,16 +109,15 @@ class _HomePageState extends State<HomePage>
|
||||
// 资产卡片(含总盈利 + 可折叠盈亏日历)
|
||||
_AssetCard(
|
||||
overview: provider.overview,
|
||||
onDeposit: () => showDepositDialog(context),
|
||||
onDeposit: _showDeposit,
|
||||
),
|
||||
SizedBox(height: AppSpacing.md),
|
||||
// 快捷操作栏
|
||||
QuickActionsRow(
|
||||
onDeposit: () => showDepositDialog(context),
|
||||
onWithdraw: () => showWithdrawDialog(context, provider.fundAccount?.balance),
|
||||
onTransfer: () => _navigateToTransfer(context),
|
||||
onProfit: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const ProfitAnalysisPage())),
|
||||
onBills: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const BillsPage())),
|
||||
onDeposit: _showDeposit,
|
||||
onWithdraw: () => _navigateToAssetPage(),
|
||||
onTransfer: () => _navigateToAssetPage(),
|
||||
onBills: () => _navigateToAssetPage(),
|
||||
),
|
||||
SizedBox(height: AppSpacing.md),
|
||||
// 福利中心入口卡片
|
||||
@@ -147,82 +143,303 @@ class _HomePageState extends State<HomePage>
|
||||
);
|
||||
}
|
||||
|
||||
/// 跳转到划转页面
|
||||
void _navigateToTransfer(BuildContext context) async {
|
||||
final result = await Navigator.push<bool>(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const TransferPage()),
|
||||
void _showDeposit() {
|
||||
final amountController = TextEditingController();
|
||||
final formKey = GlobalKey<ShadFormState>();
|
||||
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'充值',
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
'资产: USDT',
|
||||
style: AppTextStyles.bodyMedium(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(AppSpacing.sm),
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
),
|
||||
child: Icon(LucideIcons.wallet, color: context.colors.secondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
ShadForm(
|
||||
key: formKey,
|
||||
child: ShadInputFormField(
|
||||
id: 'amount',
|
||||
controller: amountController,
|
||||
label: const Text('充值金额'),
|
||||
placeholder: const Text('0.00'),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
validator: (v) {
|
||||
if (v == null || v.isEmpty) return '请输入金额';
|
||||
final n = double.tryParse(v);
|
||||
if (n == null || n <= 0) return '请输入有效金额';
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '取消',
|
||||
type: NeonButtonType.outline,
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 48,
|
||||
showGlow: false,
|
||||
),
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '下一步',
|
||||
type: NeonButtonType.primary,
|
||||
onPressed: () async {
|
||||
if (formKey.currentState!.saveAndValidate()) {
|
||||
Navigator.of(ctx).pop();
|
||||
final response = await context
|
||||
.read<AssetProvider>()
|
||||
.deposit(amount: amountController.text);
|
||||
if (mounted) {
|
||||
if (response.success && response.data != null) {
|
||||
_showDepositResultDialog(context, response.data!);
|
||||
} else {
|
||||
_showResultDialog(
|
||||
'申请失败',
|
||||
response.message ?? '请稍后重试',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
height: 48,
|
||||
showGlow: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
final orderNo = data['orderNo'] as String? ?? '';
|
||||
final amount = data['amount']?.toString() ?? '0.00';
|
||||
final walletAddress = data['walletAddress'] as String? ?? '';
|
||||
final walletNetwork = data['walletNetwork'] as String? ?? 'TRC20';
|
||||
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: Icons.check_circle,
|
||||
color: AppColorScheme.up,
|
||||
size: 24,
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Text(
|
||||
'充值申请成功',
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
_InfoRow(label: '订单号', value: orderNo),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
_InfoRow(label: '充值金额', value: '$amount USDT', isBold: true),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
Text(
|
||||
'请向以下地址转账:',
|
||||
style: AppTextStyles.bodyMedium(context),
|
||||
),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
_WalletAddressCard(address: walletAddress, network: walletNetwork),
|
||||
SizedBox(height: AppSpacing.md),
|
||||
Container(
|
||||
padding: EdgeInsets.all(AppSpacing.sm),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorScheme.warning.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
border: Border.all(color: AppColorScheme.warning.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, size: 16, color: AppColorScheme.warning),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'转账完成后请点击"已打款"按钮确认',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: AppColorScheme.warning,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '稍后确认',
|
||||
type: NeonButtonType.outline,
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
_navigateToAssetPage();
|
||||
},
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
),
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '已打款',
|
||||
type: NeonButtonType.primary,
|
||||
onPressed: () async {
|
||||
Navigator.of(ctx).pop();
|
||||
final response = await context
|
||||
.read<AssetProvider>()
|
||||
.confirmPay(orderNo);
|
||||
if (context.mounted) {
|
||||
_showResultDialog(
|
||||
response.success ? '确认成功' : '确认失败',
|
||||
response.success ? '请等待管理员审核' : response.message,
|
||||
);
|
||||
_navigateToAssetPage();
|
||||
}
|
||||
},
|
||||
height: 44,
|
||||
showGlow: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showResultDialog(String title, String? message) {
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(title,
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
if (message != null) ...[
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
Text(message,
|
||||
style: AppTextStyles.bodyMedium(context),
|
||||
textAlign: TextAlign.center),
|
||||
],
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: NeonButton(
|
||||
text: '确定',
|
||||
type: NeonButtonType.primary,
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 跳转到资产页面
|
||||
void _navigateToAssetPage() {
|
||||
final mainState = context.findAncestorStateOfType<MainPageState>();
|
||||
mainState?.switchToTab(3);
|
||||
}
|
||||
|
||||
void _navigateToWelfareCenter() {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const WelfareCenterPage()),
|
||||
);
|
||||
if (result == true && context.mounted) {
|
||||
context.read<AssetProvider>().refreshAll(force: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 资产卡片(含总盈利 + 可折叠盈亏日历)
|
||||
/// Header 栏:品牌名 + 搜索/通知/头像
|
||||
/// 资产卡片(含总盈利)
|
||||
class _AssetCard extends StatefulWidget {
|
||||
class _AssetCard extends StatelessWidget {
|
||||
final AssetOverview? overview;
|
||||
final VoidCallback onDeposit;
|
||||
|
||||
const _AssetCard({required this.overview, required this.onDeposit});
|
||||
|
||||
@override
|
||||
State<_AssetCard> createState() => _AssetCardState();
|
||||
}
|
||||
|
||||
class _AssetCardState extends State<_AssetCard> {
|
||||
Map<String, dynamic>? _profitData;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _loadProfit());
|
||||
}
|
||||
|
||||
double get _totalProfit {
|
||||
final v = widget.overview?.totalProfit;
|
||||
final v = overview?.totalProfit;
|
||||
if (v == null) return 0;
|
||||
return double.tryParse(v) ?? 0;
|
||||
}
|
||||
|
||||
Future<void> _loadProfit() async {
|
||||
try {
|
||||
final now = DateTime.now();
|
||||
final assetService = context.read<AssetService>();
|
||||
final response = await assetService.getDailyProfit(
|
||||
year: now.year,
|
||||
month: now.month,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_profitData = response.data;
|
||||
});
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
double? get _todayProfit {
|
||||
if (_profitData == null) return null;
|
||||
final daily = _profitData!['daily'] as Map<String, dynamic>?;
|
||||
if (daily == null) return null;
|
||||
final now = DateTime.now();
|
||||
final todayKey = '${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}';
|
||||
final value = daily[todayKey];
|
||||
if (value == null) return null;
|
||||
return (value is num) ? value.toDouble() : double.tryParse(value.toString());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final upColor = context.appColors.up;
|
||||
final downColor = context.appColors.down;
|
||||
final isProfit = _totalProfit >= 0;
|
||||
final todayProfit = _todayProfit;
|
||||
final isTodayProfit = (todayProfit ?? 0) >= 0;
|
||||
|
||||
// 总资产
|
||||
final totalAsset = widget.overview?.totalAsset ?? '0.00';
|
||||
final totalAsset = overview?.totalAsset ?? '0.00';
|
||||
final displayAsset = _formatAsset(totalAsset);
|
||||
|
||||
return GlassPanel(
|
||||
@@ -240,7 +457,7 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
style: AppTextStyles.bodyLarge(context), // 13px
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: widget.onDeposit,
|
||||
onTap: onDeposit,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
@@ -285,8 +502,8 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
// 今日盈亏卡片
|
||||
Expanded(
|
||||
child: _ProfitStatCard(
|
||||
label: '预估今日盈亏',
|
||||
value: _todayProfit,
|
||||
label: '今日盈亏',
|
||||
value: null, // 移除日历后不显示今日盈亏
|
||||
upColor: upColor,
|
||||
downColor: downColor,
|
||||
onTap: () => Navigator.push(
|
||||
@@ -299,7 +516,7 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
// 总盈亏卡片
|
||||
Expanded(
|
||||
child: _ProfitStatCard(
|
||||
label: '预估总盈亏',
|
||||
label: '总盈亏',
|
||||
value: _totalProfit,
|
||||
upColor: upColor,
|
||||
downColor: downColor,
|
||||
@@ -337,16 +554,9 @@ class _WelfareCard extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
context.colors.primary.withValues(alpha: 0.15),
|
||||
context.colors.secondary.withValues(alpha: 0.1),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: context.colors.surface, // 白色背景(跟随主题)
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
border: Border.all(color: context.colors.primary.withValues(alpha: 0.2)),
|
||||
border: Border.all(color: context.colors.outlineVariant.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -386,14 +596,14 @@ class _WelfareCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
// 右侧按钮
|
||||
// 右侧按钮 - 黄色背景
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
vertical: AppSpacing.sm,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: context.appColors.ctaGradient,
|
||||
color: const Color(0xFFF59E0B), // 黄色背景
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
),
|
||||
child: Row(
|
||||
@@ -420,7 +630,7 @@ class _WelfareCard extends StatelessWidget {
|
||||
'查看',
|
||||
style: AppTextStyles.headlineSmall(context).copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: context.colors.onPrimary,
|
||||
color: Colors.white, // 白色文字
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -608,6 +818,88 @@ class _HoldingItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 信息行组件
|
||||
class _InfoRow extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
final bool isBold;
|
||||
|
||||
const _InfoRow({required this.label, required this.value, this.isBold = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(label,
|
||||
style: AppTextStyles.bodyMedium(context)),
|
||||
Text(value,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
|
||||
fontFeatures: isBold ? const [FontFeature.tabularFigures()] : null,
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 钱包地址卡片
|
||||
class _WalletAddressCard extends StatelessWidget {
|
||||
final String address;
|
||||
final String network;
|
||||
|
||||
const _WalletAddressCard({required this.address, required this.network});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
border: Border.all(color: context.colors.outlineVariant.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
address,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
fontFamily: 'monospace',
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: address));
|
||||
ToastUtils.show('地址已复制到剪贴板');
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(AppSpacing.xs),
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.primary.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
child: Icon(LucideIcons.copy,
|
||||
size: 16, color: context.colors.primary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
'网络: $network',
|
||||
style: AppTextStyles.bodySmall(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 盈亏统计小卡片
|
||||
class _ProfitStatCard extends StatelessWidget {
|
||||
final String label;
|
||||
|
||||
@@ -142,15 +142,17 @@ class _BottomNavBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
// Light: #FFFFFF, Dark: #0F172A
|
||||
final backgroundColor = isDark ? const Color(0xFF0F172A) : const Color(0xFFFFFFFF);
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerLow,
|
||||
color: backgroundColor,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(AppRadius.xxl + AppSpacing.sm)),
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.15),
|
||||
color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.15),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -193,15 +195,8 @@ class _NavItemWidget extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md, vertical: AppSpacing.sm),
|
||||
decoration: isSelected
|
||||
? BoxDecoration(
|
||||
color: colorScheme.primary.withValues(alpha: 0.1),
|
||||
borderRadius: AppRadius.radiusMd,
|
||||
)
|
||||
: null,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
@@ -222,7 +222,7 @@ class _FeaturedCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'${coin.code}/USDT',
|
||||
style: AppTextStyles.headlineMedium(context),
|
||||
style: AppTextStyles.labelLarge(context), // 缩小文字
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.xs + 2, vertical: 2),
|
||||
@@ -234,6 +234,7 @@ class _FeaturedCard extends StatelessWidget {
|
||||
coin.formattedChange,
|
||||
style: AppTextStyles.labelSmall(context).copyWith(
|
||||
color: changeColor,
|
||||
fontSize: 10, // 缩小文字
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -242,12 +243,14 @@ class _FeaturedCard extends StatelessWidget {
|
||||
// 第二行:价格
|
||||
Text(
|
||||
'\$${_formatFeaturedPrice(coin)}',
|
||||
style: AppTextStyles.displayMedium(context),
|
||||
style: AppTextStyles.headlineLarge(context).copyWith( // 缩小文字
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
// 第三行:币种全名
|
||||
Text(
|
||||
coin.name,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
style: AppTextStyles.bodySmall(context).copyWith( // 缩小文字
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -307,7 +310,7 @@ class _MiniBarChart extends StatelessWidget {
|
||||
children: heights.map((h) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 1.5),
|
||||
padding: const EdgeInsets.only(left: 2), // 增加间距
|
||||
child: Container(
|
||||
height: h,
|
||||
decoration: BoxDecoration(
|
||||
@@ -323,8 +326,8 @@ class _MiniBarChart extends StatelessWidget {
|
||||
|
||||
List<double> _generateHeights() {
|
||||
final random = Random(seed);
|
||||
final base = 8.0;
|
||||
final range = 16.0;
|
||||
final base = 6.0; // 降低基础高度
|
||||
final range = 12.0; // 降低范围
|
||||
return List.generate(6, (_) => base + random.nextDouble() * range);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class _AmountInputState extends State<AmountInput> {
|
||||
Container(
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest.withOpacity(0.3),
|
||||
color: colorScheme.surfaceContainerHighest.withOpacity(0.5), // 调整透明度
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
),
|
||||
child: TextField(
|
||||
|
||||
@@ -5,7 +5,7 @@ import '../../../../core/theme/app_theme.dart';
|
||||
|
||||
/// 交易按钮组件
|
||||
///
|
||||
/// CTA 买入/卖出按钮。profit-green底 / sell-red底,圆角lg,高48,白字16px bold。
|
||||
/// CTA 买入/卖出按钮。profit-green底 / sell-red底,圆角lg,高48,买入白字/卖出红字16px bold。
|
||||
class TradeButton extends StatelessWidget {
|
||||
final bool isBuy;
|
||||
final String? coinCode;
|
||||
@@ -27,6 +27,10 @@ class TradeButton extends StatelessWidget {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final fillColor =
|
||||
isBuy ? AppColorScheme.buyButtonFill : AppColorScheme.sellButtonFill;
|
||||
// 买入按钮文字为白色,卖出按钮文字为红色
|
||||
final textColor = isBuy
|
||||
? Colors.white
|
||||
: (enabled ? AppColorScheme.sellButtonFill : colorScheme.onSurface.withOpacity(0.3));
|
||||
|
||||
return GestureDetector(
|
||||
onTap: enabled ? onPressed : null,
|
||||
@@ -39,19 +43,19 @@ class TradeButton extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: isLoading
|
||||
? const SizedBox(
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColorScheme.darkOnPrimary,
|
||||
color: isBuy ? Colors.white : AppColorScheme.sellButtonFill,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'${isBuy ? '买入' : '卖出'} ${coinCode ?? ""}',
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
color: enabled
|
||||
? AppColorScheme.darkOnPrimary
|
||||
? textColor
|
||||
: colorScheme.onSurface.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -207,7 +207,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHighest, // 移除 0.5 透明度
|
||||
color: context.colors.surfaceContainerHighest.withOpacity(0.5), // 更柔和的颜色
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
child: Center(
|
||||
|
||||
@@ -121,7 +121,7 @@ class _TradePageState extends State<TradePage>
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppSpacing.md, 0, AppSpacing.md, AppSpacing.xl + AppSpacing.sm,
|
||||
AppSpacing.md, AppSpacing.md, AppSpacing.md, AppSpacing.xl + AppSpacing.sm, // 添加顶部间距
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user