111
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user