VipPerkProgressRow constructor

VipPerkProgressRow({
  1. Key? key,
  2. required int currentTier,
  3. required int currentPoints,
  4. int? nextTierPoints,
  5. String? tierLabel,
  6. List<VipPerk> perks = const [],
  7. VoidCallback? onAction,
  8. String actionLabel = 'View Perks',
  9. String? semanticLabel,
})

Implementation

VipPerkProgressRow({
  super.key,
  required this.currentTier,
  required this.currentPoints,
  this.nextTierPoints,
  this.tierLabel,
  this.perks = const [],
  this.onAction,
  this.actionLabel = 'View Perks',
  this.semanticLabel,
}) {
  if (currentTier < 0) {
    throw ArgumentError.value(
      currentTier,
      'currentTier',
      'must be non-negative',
    );
  }
  if (currentPoints < 0) {
    throw ArgumentError.value(
      currentPoints,
      'currentPoints',
      'must be non-negative',
    );
  }
  if (nextTierPoints != null && nextTierPoints! <= 0) {
    throw ArgumentError.value(
      nextTierPoints,
      'nextTierPoints',
      'must be positive when provided',
    );
  }
  if (tierLabel != null && tierLabel!.trim().isEmpty) {
    throw ArgumentError.value(tierLabel, 'tierLabel', 'must not be empty');
  }
  if (actionLabel.trim().isEmpty) {
    throw ArgumentError.value(
      actionLabel,
      'actionLabel',
      'must not be empty',
    );
  }
}