| 1 | import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; |
| 2 | import 'package:flutter/foundation.dart'; |
| 3 | |
| 4 | class DogecoinTransactionPriority extends BitcoinTransactionPriority { |
| 5 | const DogecoinTransactionPriority({required String title, required int raw}) |
| 6 | : super(title: title, raw: raw); |
| 7 | |
| 8 | static const List<DogecoinTransactionPriority> all = [fast, medium, slow]; |
| 9 | static const DogecoinTransactionPriority slow = |
| 10 | DogecoinTransactionPriority(title: 'Slow', raw: 0); |
| 11 | static const DogecoinTransactionPriority medium = |
| 12 | DogecoinTransactionPriority(title: 'Medium', raw: 1); |
| 13 | static const DogecoinTransactionPriority fast = |
| 14 | DogecoinTransactionPriority(title: 'Fast', raw: 2); |
| 15 | |
| 16 | static DogecoinTransactionPriority deserialize({required int raw}) { |
| 17 | switch (raw) { |
| 18 | case 0: |
| 19 | return slow; |
| 20 | case 1: |
| 21 | return medium; |
| 22 | case 2: |
| 23 | return fast; |
| 24 | default: |
| 25 | if (kDebugMode) { |
| 26 | throw Exception('Unexpected token: $raw for DogecoinTransactionPriority deserialize'); |
| 27 | } |
| 28 | return medium; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | @override |
| 33 | String get units => 'koinu'; |
| 34 | |
| 35 | @override |
| 36 | String toString() { |
| 37 | var label = ''; |
| 38 | |
| 39 | switch (this) { |
| 40 | case DogecoinTransactionPriority.slow: |
| 41 | label = 'Slow'; // S.current.transaction_priority_slow; |
| 42 | break; |
| 43 | case DogecoinTransactionPriority.medium: |
| 44 | label = 'Medium'; // S.current.transaction_priority_medium; |
| 45 | break; |
| 46 | case DogecoinTransactionPriority.fast: |
| 47 | label = 'Fast'; // S.current.transaction_priority_fast; |
| 48 | break; |
| 49 | default: |
| 50 | break; |
| 51 | } |
| 52 | |
| 53 | return label; |
| 54 | } |
| 55 | } |