This commit is contained in:
sion
2026-04-07 01:05:05 +08:00
parent edad10ff06
commit 5ca1274607
83 changed files with 1561 additions and 1241 deletions

View File

@@ -1,4 +1,4 @@
/// 币种模型
/// 幣種模型
class Coin {
final int id;
final String code;
@@ -7,7 +7,7 @@ class Coin {
final double price;
final double? priceUsd;
final double? priceCny;
final int priceType; // 1=实时价格, 2=管理员设
final int priceType; // 1=實時價格, 2=管理員設
final double change24h;
final double? high24h;
final double? low24h;
@@ -70,7 +70,7 @@ class Coin {
};
}
/// 显示图标Unicode 符
/// 顯示圖標Unicode 符
String get displayIcon {
const icons = {
'BTC': '\u20BF',
@@ -85,22 +85,22 @@ class Coin {
return icons[code] ?? '\u25CF';
}
/// 格式化价格显
/// 格式化價格顯
String get formattedPrice {
if (price >= 1000) return price.toStringAsFixed(2);
if (price >= 1) return price.toStringAsFixed(4);
return price.toStringAsFixed(6);
}
/// 格式化跌幅
/// 格式化跌幅
String get formattedChange {
final prefix = change24h >= 0 ? '+' : '';
return '$prefix${change24h.toStringAsFixed(2)}%';
}
/// 是否上
/// 是否上
bool get isUp => change24h >= 0;
/// 是否为实时价
/// 是否為實時價
bool get isRealtime => priceType == 1;
}