OnboardingFlowQueueCard constructor

OnboardingFlowQueueCard({
  1. Key? key,
  2. required List<OnboardingFlowRow> rows,
  3. Future<void> onMarkSeen(
    1. String flowId
    )?,
  4. bool busy = false,
  5. int maxVisibleRows = 20,
  6. String title = 'Onboarding flows',
  7. String emptyLabel = 'No onboarding flows registered.',
  8. String hiddenRowsLabel = 'More flows hidden',
  9. String nextLabel = 'Next',
  10. String seenLabel = 'Seen',
  11. String pendingLabel = 'Not seen yet',
  12. String priorityLabel = 'Priority',
  13. String versionLabel = 'Version',
  14. String markSeenLabel = 'Mark seen',
  15. String actionErrorLabel = 'Action failed. Try again.',
})

Implementation

OnboardingFlowQueueCard({
  super.key,
  required List<OnboardingFlowRow> rows,
  this.onMarkSeen,
  this.busy = false,
  this.maxVisibleRows = 20,
  this.title = 'Onboarding flows',
  this.emptyLabel = 'No onboarding flows registered.',
  this.hiddenRowsLabel = 'More flows hidden',
  this.nextLabel = 'Next',
  this.seenLabel = 'Seen',
  this.pendingLabel = 'Not seen yet',
  this.priorityLabel = 'Priority',
  this.versionLabel = 'Version',
  this.markSeenLabel = 'Mark seen',
  this.actionErrorLabel = 'Action failed. Try again.',
}) : rows = List.unmodifiable(rows) {
  if (maxVisibleRows <= 0) {
    throw ArgumentError.value(
      maxVisibleRows,
      'maxVisibleRows',
      'must be > 0',
    );
  }
  if (this.rows.where((r) => r.isNext).length > 1) {
    throw ArgumentError.value(rows, 'rows', 'at most one row can be next');
  }
  if (this.rows.map((r) => r.flowId).toSet().length != this.rows.length) {
    throw ArgumentError.value(rows, 'rows', 'flowId values must be unique');
  }
  for (final (name, value) in [
    ('title', title),
    ('emptyLabel', emptyLabel),
    ('hiddenRowsLabel', hiddenRowsLabel),
    ('nextLabel', nextLabel),
    ('seenLabel', seenLabel),
    ('pendingLabel', pendingLabel),
    ('priorityLabel', priorityLabel),
    ('versionLabel', versionLabel),
    ('markSeenLabel', markSeenLabel),
    ('actionErrorLabel', actionErrorLabel),
  ]) {
    if (value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}