CloudSaveStatusCard constructor
CloudSaveStatusCard({
- Key? key,
- required CloudSaveStatus status,
- int pendingCount = 0,
- String? lastSyncText,
- Future<
void> onSync()?, - bool busy = false,
- String title = 'Cloud save',
- String readyLabel = 'Ready to sync',
- String syncingLabel = 'Syncing',
- String syncedLabel = 'Synced',
- String offlineLabel = 'Offline',
- String errorLabel = 'Sync failed. Try again.',
- String pendingLabel = 'Pending changes',
- String syncLabel = 'Sync now',
- String retryLabel = 'Retry sync',
Implementation
CloudSaveStatusCard({
super.key,
required this.status,
this.pendingCount = 0,
this.lastSyncText,
this.onSync,
this.busy = false,
this.title = 'Cloud save',
this.readyLabel = 'Ready to sync',
this.syncingLabel = 'Syncing',
this.syncedLabel = 'Synced',
this.offlineLabel = 'Offline',
this.errorLabel = 'Sync failed. Try again.',
this.pendingLabel = 'Pending changes',
this.syncLabel = 'Sync now',
this.retryLabel = 'Retry sync',
}) {
if (pendingCount < 0) {
throw ArgumentError.value(pendingCount, 'pendingCount', 'must be >= 0');
}
for (final (name, value) in [
('title', title),
('readyLabel', readyLabel),
('syncingLabel', syncingLabel),
('syncedLabel', syncedLabel),
('offlineLabel', offlineLabel),
('errorLabel', errorLabel),
('pendingLabel', pendingLabel),
('syncLabel', syncLabel),
('retryLabel', retryLabel),
('lastSyncText', lastSyncText),
]) {
if (value != null && value.trim().isEmpty) {
throw ArgumentError.value(value, name, 'must not be blank');
}
}
}