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:
parent
bc3d800936
commit
07f7f26948
|
|
@ -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]) {
|
String formatPercent(String? value, [int precision = 2]) {
|
||||||
if (value == null || value.isEmpty) return '0%';
|
if (value == null || value.isEmpty) return '0%';
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
_buildMarketDataItem(
|
_buildMarketDataItem(
|
||||||
'已销毁量',
|
'已销毁量',
|
||||||
market != null ? formatWithCommas(market.blackHoleAmount) : null,
|
market != null ? formatIntWithCommas(market.blackHoleAmount) : null,
|
||||||
_red,
|
_red,
|
||||||
isLoading,
|
isLoading,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue