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:
parent
eacdfddff8
commit
a68fe5e999
|
|
@ -366,7 +366,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
// 流通池:显示全网已挖矿产出的积分股总量(totalMined),
|
// 流通池:显示全网已挖矿产出的积分股总量(totalMined),
|
||||||
// 而非交易流通池(circulationPool,目前无交易故为0)
|
// 而非交易流通池(circulationPool,目前无交易故为0)
|
||||||
_buildMarketDataItem(
|
_buildMarketDataItem(
|
||||||
'流通池',
|
'已分配积分股',
|
||||||
market != null ? formatCompact(market.totalMined) : null,
|
market != null ? formatCompact(market.totalMined) : null,
|
||||||
_orange,
|
_orange,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|
@ -386,11 +386,18 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
),
|
),
|
||||||
Container(width: 1, height: 24, color: bgGray),
|
Container(width: 1, height: 24, color: bgGray),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
_buildMarketDataItem(
|
Expanded(
|
||||||
'已销毁量',
|
child: GestureDetector(
|
||||||
market != null ? formatIntWithCommas(market.blackHoleAmount) : null,
|
behavior: HitTestBehavior.opaque,
|
||||||
_red,
|
onTap: market != null ? () => _showBurnDetailDialog(market) : null,
|
||||||
isLoading,
|
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) {
|
Widget _buildMarketDataItem(String label, String? value, Color valueColor, bool isLoading) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(
|
child: _buildMarketDataItemContent(label, value, valueColor, isLoading),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
);
|
||||||
children: [
|
}
|
||||||
Text(label, style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
|
|
||||||
const SizedBox(height: 4),
|
Widget _buildMarketDataItemContent(String label, String? value, Color valueColor, bool isLoading, {bool showTapHint = false}) {
|
||||||
DataText(
|
return Column(
|
||||||
data: value,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
isLoading: isLoading,
|
children: [
|
||||||
placeholder: '--,---,---',
|
Row(
|
||||||
style: TextStyle(
|
mainAxisSize: MainAxisSize.min,
|
||||||
fontSize: 14,
|
children: [
|
||||||
fontWeight: FontWeight.bold,
|
Text(label, style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))),
|
||||||
color: valueColor,
|
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) {
|
Widget _buildTradingPanel(AsyncValue<PriceInfo?> priceAsync) {
|
||||||
final priceInfo = priceAsync.valueOrNull;
|
final priceInfo = priceAsync.valueOrNull;
|
||||||
final currentPrice = priceInfo?.price ?? '0';
|
final currentPrice = priceInfo?.price ?? '0';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue