SyncStatusCard constructor
SyncStatusCard({
- Key? key,
- required SyncStatus status,
- required Future<
void> onSync(), - String? lastSyncedText,
- bool busy = false,
- String title = 'Sync',
- String idleLabel = 'Not synced yet',
- String syncingLabel = 'Syncing',
- String syncedLabel = 'Up to date',
- String failedLabel = 'Sync failed. Try again.',
- String lastSyncedLabel = 'Last synced',
- String syncLabel = 'Sync now',
- String retryLabel = 'Retry sync',
- String actionErrorLabel = 'Action failed. Try again.',
Implementation
SyncStatusCard({
super.key,
required this.status,
required this.onSync,
this.lastSyncedText,
this.busy = false,
this.title = 'Sync',
this.idleLabel = 'Not synced yet',
this.syncingLabel = 'Syncing',
this.syncedLabel = 'Up to date',
this.failedLabel = 'Sync failed. Try again.',
this.lastSyncedLabel = 'Last synced',
this.syncLabel = 'Sync now',
this.retryLabel = 'Retry sync',
this.actionErrorLabel = 'Action failed. Try again.',
}) {
for (final (name, value) in [
('title', title),
('idleLabel', idleLabel),
('syncingLabel', syncingLabel),
('syncedLabel', syncedLabel),
('failedLabel', failedLabel),
('lastSyncedLabel', lastSyncedLabel),
('syncLabel', syncLabel),
('retryLabel', retryLabel),
('actionErrorLabel', actionErrorLabel),
('lastSyncedText', lastSyncedText),
]) {
if (value != null && value.trim().isEmpty) {
throw ArgumentError.value(value, name, 'must not be blank');
}
}
}