GiftLivesRequestCard constructor

GiftLivesRequestCard({
  1. Key? key,
  2. required GiftLivesRequest request,
  3. required ValueChanged<String> onSendLife,
  4. String sendLabel = 'Send Life',
  5. String sentLabel = 'Sent',
  6. String expiredLabel = 'Expired',
  7. String? statusText,
  8. Duration guardWindow = const Duration(milliseconds: 600),
})

Implementation

GiftLivesRequestCard({
  super.key,
  required this.request,
  required this.onSendLife,
  this.sendLabel = 'Send Life',
  this.sentLabel = 'Sent',
  this.expiredLabel = 'Expired',
  this.statusText,
  this.guardWindow = const Duration(milliseconds: 600),
}) {
  if (request.requestId.trim().isEmpty || request.senderName.trim().isEmpty) {
    throw ArgumentError.value(
      request,
      'request',
      'requestId and senderName must not be empty',
    );
  }
  if (sendLabel.trim().isEmpty ||
      sentLabel.trim().isEmpty ||
      expiredLabel.trim().isEmpty) {
    throw ArgumentError('labels must not be empty');
  }
  if (guardWindow.isNegative) {
    throw ArgumentError.value(
      guardWindow,
      'guardWindow',
      'must not be negative',
    );
  }
}