cake_wallet/lib/entities/transaction_priority.dart

57 lines
1.7 KiB
Dart
Raw Normal View History

2020-01-04 19:31:52 +00:00
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 TransactionPriority extends EnumerableItem<int> with Serializable<int> {
2020-01-08 12:26:34 +00:00
const TransactionPriority({String title, int raw})
: super(title: title, raw: raw);
2020-01-04 19:31:52 +00:00
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 '';
}
}
}