feat(mining-app): 已销毁量去掉小数位显示

- format_utils.dart: 新增 formatIntWithCommas(),逗号千位分隔但不保留小数
- trading_page.dart: 已销毁量改用 formatIntWithCommas()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-13 07:47:05 -08:00
parent bc3d800936
commit 07f7f26948
2 changed files with 13 additions and 1 deletions

View File

@ -44,6 +44,18 @@ String formatWithCommas(String? value) {
}
}
/// +
String formatIntWithCommas(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 {

View File

@ -386,7 +386,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
const SizedBox(width: 16),
_buildMarketDataItem(
'已销毁量',
market != null ? formatWithCommas(market.blackHoleAmount) : null,
market != null ? formatIntWithCommas(market.blackHoleAmount) : null,
_red,
isLoading,
),