SyncStatusCard constructor

SyncStatusCard({
  1. Key? key,
  2. required SyncStatus status,
  3. required Future<void> onSync(),
  4. String? lastSyncedText,
  5. bool busy = false,
  6. String title = 'Sync',
  7. String idleLabel = 'Not synced yet',
  8. String syncingLabel = 'Syncing',
  9. String syncedLabel = 'Up to date',
  10. String failedLabel = 'Sync failed. Try again.',
  11. String lastSyncedLabel = 'Last synced',
  12. String syncLabel = 'Sync now',
  13. String retryLabel = 'Retry sync',
  14. 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');
    }
  }
}