ContentPackStatusCard constructor

ContentPackStatusCard({
  1. Key? key,
  2. required ContentPackStatus status,
  3. required int contentVersion,
  4. String? updatedAtText,
  5. bool busy = false,
  6. Future<void> onRefresh()?,
  7. String title = 'Content pack',
  8. String loadingLabel = 'Loading content',
  9. String readyLabel = 'Content ready',
  10. String refreshingLabel = 'Updating content',
  11. String errorLabel = 'Content update failed. Try again.',
  12. String versionLabel = 'Version',
  13. String updatedLabel = 'Updated',
  14. String refreshLabel = 'Refresh content',
  15. String retryLabel = 'Retry update',
  16. String actionErrorLabel = 'Action failed. Try again.',
})

Implementation

ContentPackStatusCard({
  super.key,
  required this.status,
  required this.contentVersion,
  this.updatedAtText,
  this.busy = false,
  this.onRefresh,
  this.title = 'Content pack',
  this.loadingLabel = 'Loading content',
  this.readyLabel = 'Content ready',
  this.refreshingLabel = 'Updating content',
  this.errorLabel = 'Content update failed. Try again.',
  this.versionLabel = 'Version',
  this.updatedLabel = 'Updated',
  this.refreshLabel = 'Refresh content',
  this.retryLabel = 'Retry update',
  this.actionErrorLabel = 'Action failed. Try again.',
}) {
  if (contentVersion < 0) {
    throw ArgumentError.value(
      contentVersion,
      'contentVersion',
      'must be >= 0',
    );
  }
  for (final (name, value) in [
    ('title', title),
    ('loadingLabel', loadingLabel),
    ('readyLabel', readyLabel),
    ('refreshingLabel', refreshingLabel),
    ('errorLabel', errorLabel),
    ('versionLabel', versionLabel),
    ('updatedLabel', updatedLabel),
    ('refreshLabel', refreshLabel),
    ('retryLabel', retryLabel),
    ('actionErrorLabel', actionErrorLabel),
    ('updatedAtText', updatedAtText),
  ]) {
    if (value != null && value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}