From a68fe5e99912bb4120800da6335300c8702e5a56 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 25 Feb 2026 23:55:37 -0800 Subject: [PATCH] =?UTF-8?q?feat(mining-app):=20=E5=85=91=E6=8D=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2"=E6=B5=81=E9=80=9A=E6=B1=A0"=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E5=8F=8A"=E5=B7=B2=E9=94=80=E6=AF=81=E9=87=8F"=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=9F=A5=E7=9C=8B=E9=94=80=E6=AF=81=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将市场数据卡片中的"流通池"标签改名为"已分配积分股" - 展示值不变,仍为 totalMined(全网已挖矿产出总量) 2. "已销毁量"新增点击交互,点击弹出"销毁明细"对话框: - 系统总销毁量(blackHoleAmount):当前页面已展示的黑洞销毁总量 - 全网兑换销毁量(circulationPool):卖出交易实际产生的流通池金额 - 标签旁显示 info_outline 图标提示可点击 3. 重构 _buildMarketDataItem,拆分出 _buildMarketDataItemContent: - _buildMarketDataItem:包含 Expanded 包裹,供普通数据项使用 - _buildMarketDataItemContent:纯内容组件,支持 showTapHint 参数 - 避免 Row > GestureDetector > Expanded 的布局冲突 Co-Authored-By: Claude Opus 4.6 --- .../pages/trading/trading_page.dart | 104 ++++++++++++++---- 1 file changed, 84 insertions(+), 20 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/trading/trading_page.dart b/frontend/mining-app/lib/presentation/pages/trading/trading_page.dart index 97023bb8..affa49c5 100644 --- a/frontend/mining-app/lib/presentation/pages/trading/trading_page.dart +++ b/frontend/mining-app/lib/presentation/pages/trading/trading_page.dart @@ -366,7 +366,7 @@ class _TradingPageState extends ConsumerState { // 流通池:显示全网已挖矿产出的积分股总量(totalMined), // 而非交易流通池(circulationPool,目前无交易故为0) _buildMarketDataItem( - '流通池', + '已分配积分股', market != null ? formatCompact(market.totalMined) : null, _orange, isLoading, @@ -386,11 +386,18 @@ class _TradingPageState extends ConsumerState { ), 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 { 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 priceAsync) { final priceInfo = priceAsync.valueOrNull; final currentPrice = priceInfo?.price ?? '0';