2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/enumerable_item.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
class BalanceDisplayMode extends EnumerableItem<int> with Serializable<int> {
|
2020-01-08 12:26:34 +00:00
|
|
|
const BalanceDisplayMode({@required String title, @required int raw})
|
|
|
|
: super(title: title, raw: raw);
|
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
static const all = [
|
2021-01-11 17:15:27 +00:00
|
|
|
BalanceDisplayMode.hiddenBalance,
|
|
|
|
BalanceDisplayMode.displayableBalance,
|
2020-01-04 19:31:52 +00:00
|
|
|
];
|
|
|
|
static const fullBalance = BalanceDisplayMode(raw: 0, title: 'Full Balance');
|
|
|
|
static const availableBalance =
|
|
|
|
BalanceDisplayMode(raw: 1, title: 'Available Balance');
|
|
|
|
static const hiddenBalance =
|
|
|
|
BalanceDisplayMode(raw: 2, title: 'Hidden Balance');
|
2021-01-11 17:15:27 +00:00
|
|
|
static const displayableBalance =
|
|
|
|
BalanceDisplayMode(raw: 3, title: 'Displayable Balance');
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
static BalanceDisplayMode deserialize({int raw}) {
|
|
|
|
switch (raw) {
|
|
|
|
case 0:
|
|
|
|
return fullBalance;
|
|
|
|
case 1:
|
|
|
|
return availableBalance;
|
|
|
|
case 2:
|
|
|
|
return hiddenBalance;
|
2021-01-11 17:15:27 +00:00
|
|
|
case 3:
|
|
|
|
return displayableBalance;
|
2020-01-04 19:31:52 +00:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
switch (this) {
|
|
|
|
case BalanceDisplayMode.fullBalance:
|
|
|
|
return S.current.xmr_full_balance;
|
|
|
|
case BalanceDisplayMode.availableBalance:
|
|
|
|
return S.current.xmr_available_balance;
|
|
|
|
case BalanceDisplayMode.hiddenBalance:
|
|
|
|
return S.current.xmr_hidden;
|
2021-01-11 17:15:27 +00:00
|
|
|
case BalanceDisplayMode.displayableBalance:
|
|
|
|
return S.current.displayable;
|
2020-01-04 19:31:52 +00:00
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|