feat(mining-app): 兑换页面积分股池和已销毁量改为原始数字显示
将"市场数据"中的"积分股池"和"已销毁量"从缩写单位(万/亿) 改为原始十进制数字显示,使用逗号千位分隔符。 - format_utils.dart: 新增 formatWithCommas() 函数,直接显示原始 数值并用逗号每3位分隔,不再缩写为万/亿 - trading_page.dart: 积分股池和已销毁量两个字段从 formatCompact() 改为 formatWithCommas() 示例: 52.38亿 → 5,238,000,000 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7564c1151d
commit
6082725c80
|
|
@ -32,6 +32,18 @@ String formatCompact(String? value) {
|
|||
}
|
||||
}
|
||||
|
||||
/// 原始数值 + 逗号千位分隔(不缩写万/亿)
|
||||
String formatWithCommas(String? value) {
|
||||
if (value == null || value.isEmpty) return '0';
|
||||
try {
|
||||
final num = double.parse(value);
|
||||
final formatter = NumberFormat('#,##0.########', 'zh_CN');
|
||||
return formatter.format(num);
|
||||
} catch (e) {
|
||||
return '0';
|
||||
}
|
||||
}
|
||||
|
||||
String formatPercent(String? value, [int precision = 2]) {
|
||||
if (value == null || value.isEmpty) return '0%';
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
children: [
|
||||
_buildMarketDataItem(
|
||||
'积分股池',
|
||||
market != null ? formatCompact(market.greenPoints) : null,
|
||||
market != null ? formatWithCommas(market.greenPoints) : null,
|
||||
_orange,
|
||||
isLoading,
|
||||
),
|
||||
|
|
@ -386,7 +386,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
const SizedBox(width: 16),
|
||||
_buildMarketDataItem(
|
||||
'已销毁量',
|
||||
market != null ? formatCompact(market.blackHoleAmount) : null,
|
||||
market != null ? formatWithCommas(market.blackHoleAmount) : null,
|
||||
_red,
|
||||
isLoading,
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue