feat(mining-app): 兑换页面"流通池"改名及"已销毁量"点击查看销毁明细

1. 将市场数据卡片中的"流通池"标签改名为"已分配积分股"
   - 展示值不变,仍为 totalMined(全网已挖矿产出总量)

2. "已销毁量"新增点击交互,点击弹出"销毁明细"对话框:
   - 系统总销毁量(blackHoleAmount):当前页面已展示的黑洞销毁总量
   - 全网兑换销毁量(circulationPool):卖出交易实际产生的流通池金额
   - 标签旁显示 info_outline 图标提示可点击

3. 重构 _buildMarketDataItem,拆分出 _buildMarketDataItemContent:
   - _buildMarketDataItem:包含 Expanded 包裹,供普通数据项使用
   - _buildMarketDataItemContent:纯内容组件,支持 showTapHint 参数
   - 避免 Row > GestureDetector > Expanded 的布局冲突

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-25 23:55:37 -08:00
parent eacdfddff8
commit a68fe5e999
1 changed files with 84 additions and 20 deletions

View File

@ -366,7 +366,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
// totalMined
// circulationPool0
_buildMarketDataItem(
'流通池',
'已分配积分股',
market != null ? formatCompact(market.totalMined) : null,
_orange,
isLoading,
@ -386,11 +386,18 @@ class _TradingPageState extends ConsumerState<TradingPage> {
),
Container(width: 1, height: 24, color: bgGray),
const SizedBox(width: 16),
_buildMarketDataItem(
'已销毁量',
market != null ? formatIntWithCommas(market.blackHoleAmount) : null,
_red,
isLoading,
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: market != null ? () => _showBurnDetailDialog(market) : null,
child: _buildMarketDataItemContent(
'已销毁量',
market != null ? formatIntWithCommas(market.blackHoleAmount) : null,
_red,
isLoading,
showTapHint: true,
),
),
),
],
),
@ -401,26 +408,83 @@ class _TradingPageState extends ConsumerState<TradingPage> {
Widget _buildMarketDataItem(String label, String? value, Color valueColor, bool isLoading) {
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
const SizedBox(height: 4),
DataText(
data: value,
isLoading: isLoading,
placeholder: '--,---,---',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: valueColor,
),
child: _buildMarketDataItemContent(label, value, valueColor, isLoading),
);
}
Widget _buildMarketDataItemContent(String label, String? value, Color valueColor, bool isLoading, {bool showTapHint = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(label, style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
if (showTapHint) ...[
const SizedBox(width: 4),
Icon(Icons.info_outline, size: 14, color: AppColors.textSecondaryOf(context)),
],
],
),
const SizedBox(height: 4),
DataText(
data: value,
isLoading: isLoading,
placeholder: '--,---,---',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: valueColor,
),
),
],
);
}
void _showBurnDetailDialog(MarketOverview market) {
final darkText = AppColors.textPrimaryOf(context);
final grayText = AppColors.textSecondaryOf(context);
showDialog(
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
backgroundColor: AppColors.cardOf(context),
title: Text(
'销毁明细',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: darkText),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildBurnDetailRow('系统总销毁量', formatIntWithCommas(market.blackHoleAmount), darkText, grayText),
const SizedBox(height: 16),
_buildBurnDetailRow('全网兑换销毁量', formatIntWithCommas(market.circulationPool), darkText, grayText),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('关闭'),
),
],
),
);
}
Widget _buildBurnDetailRow(String label, String value, Color textColor, Color labelColor) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: TextStyle(fontSize: 14, color: labelColor)),
Text(
value,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: textColor),
),
],
);
}
Widget _buildTradingPanel(AsyncValue<PriceInfo?> priceAsync) {
final priceInfo = priceAsync.valueOrNull;
final currentPrice = priceInfo?.price ?? '0';