QuestProgressPill constructor

QuestProgressPill({
  1. Key? key,
  2. required int completed,
  3. required int total,
  4. required VoidCallback onTap,
  5. int claimableCount = 0,
  6. String label = 'Quests',
  7. String? semanticLabel,
})

Implementation

QuestProgressPill({
  super.key,
  required this.completed,
  required this.total,
  required this.onTap,
  this.claimableCount = 0,
  this.label = 'Quests',
  this.semanticLabel,
}) {
  if (total <= 0) {
    throw ArgumentError.value(total, 'total', 'must be > 0');
  }
  if (completed < 0 || completed > total) {
    throw ArgumentError.value(completed, 'completed', 'must be in 0..total');
  }
  if (claimableCount < 0 || claimableCount > completed) {
    throw ArgumentError.value(
      claimableCount,
      'claimableCount',
      'must be in 0..completed',
    );
  }
  if (label.trim().isEmpty) {
    throw ArgumentError.value(label, 'label', 'must not be blank');
  }
  if (semanticLabel != null && semanticLabel!.trim().isEmpty) {
    throw ArgumentError.value(
      semanticLabel,
      'semanticLabel',
      'must not be blank',
    );
  }
}