mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:cake_wallet/generated/i18n.dart';
|
|
import 'package:cake_wallet/entities/enumerable_item.dart';
|
|
|
|
class TransactionPriority extends EnumerableItem<int> with Serializable<int> {
|
|
const TransactionPriority({String title, int raw})
|
|
: super(title: title, raw: raw);
|
|
|
|
static const all = [
|
|
TransactionPriority.slow,
|
|
TransactionPriority.regular,
|
|
TransactionPriority.medium,
|
|
TransactionPriority.fast,
|
|
TransactionPriority.fastest
|
|
];
|
|
static const slow = TransactionPriority(title: 'Slow', raw: 0);
|
|
static const regular = TransactionPriority(title: 'Regular', raw: 1);
|
|
static const medium = TransactionPriority(title: 'Medium', raw: 2);
|
|
static const fast = TransactionPriority(title: 'Fast', raw: 3);
|
|
static const fastest = TransactionPriority(title: 'Fastest', raw: 4);
|
|
static const standart = slow;
|
|
|
|
static TransactionPriority deserialize({int raw}) {
|
|
switch (raw) {
|
|
case 0:
|
|
return slow;
|
|
case 1:
|
|
return regular;
|
|
case 2:
|
|
return medium;
|
|
case 3:
|
|
return fast;
|
|
case 4:
|
|
return fastest;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
switch (this) {
|
|
case TransactionPriority.slow:
|
|
return S.current.transaction_priority_slow;
|
|
case TransactionPriority.regular:
|
|
return S.current.transaction_priority_regular;
|
|
case TransactionPriority.medium:
|
|
return S.current.transaction_priority_medium;
|
|
case TransactionPriority.fast:
|
|
return S.current.transaction_priority_fast;
|
|
case TransactionPriority.fastest:
|
|
return S.current.transaction_priority_fastest;
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
}
|