mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 18:07:44 +00:00
83 lines
No EOL
1.6 KiB
Dart
83 lines
No EOL
1.6 KiB
Dart
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
abstract class SyncStatus {
|
|
const SyncStatus();
|
|
|
|
double progress();
|
|
|
|
String title();
|
|
}
|
|
|
|
class SyncingSyncStatus extends SyncStatus {
|
|
SyncingSyncStatus(this.blocksLeft, this.ptc);
|
|
|
|
final double ptc;
|
|
final int blocksLeft;
|
|
|
|
@override
|
|
double progress() => ptc;
|
|
|
|
@override
|
|
String title() => S.current.Blocks_remaining('$blocksLeft');
|
|
|
|
@override
|
|
String toString() => '$blocksLeft';
|
|
}
|
|
|
|
class SyncedSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 1.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_syncronized;
|
|
}
|
|
|
|
class NotConnectedSyncStatus extends SyncStatus {
|
|
const NotConnectedSyncStatus();
|
|
|
|
@override
|
|
double progress() => 0.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_not_connected;
|
|
}
|
|
|
|
class StartingSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 0.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_starting_sync;
|
|
}
|
|
|
|
class FailedSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 1.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_failed_connect;
|
|
}
|
|
|
|
class ConnectingSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 0.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_connecting;
|
|
}
|
|
|
|
class ConnectedSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 0.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_connected;
|
|
}
|
|
|
|
class LostConnectionSyncStatus extends SyncStatus {
|
|
@override
|
|
double progress() => 1.0;
|
|
|
|
@override
|
|
String title() => S.current.sync_status_failed_connect;
|
|
} |