PlayerDataRightsPanel constructor

PlayerDataRightsPanel({
  1. Key? key,
  2. required Future<void> onExport(),
  3. required Future<void> onErase(),
  4. bool busy = false,
  5. String title = 'Your data',
  6. String description = 'Export a copy of your data or erase it from this device.',
  7. String exportLabel = 'Export my data',
  8. String eraseLabel = 'Erase my data',
  9. String confirmEraseLabel = 'Confirm erase',
  10. String cancelLabel = 'Cancel',
  11. String erasureWarning = 'This permanently erases your data on this device and cannot be undone.',
  12. String exportSuccessLabel = 'Your data export is ready.',
  13. String eraseSuccessLabel = 'Your device data was erased.',
  14. String errorLabel = 'Something went wrong. Please try again.',
})

Implementation

PlayerDataRightsPanel({
  super.key,
  required this.onExport,
  required this.onErase,
  this.busy = false,
  this.title = 'Your data',
  this.description =
      'Export a copy of your data or erase it from this device.',
  this.exportLabel = 'Export my data',
  this.eraseLabel = 'Erase my data',
  this.confirmEraseLabel = 'Confirm erase',
  this.cancelLabel = 'Cancel',
  this.erasureWarning =
      'This permanently erases your data on this device and cannot be undone.',
  this.exportSuccessLabel = 'Your data export is ready.',
  this.eraseSuccessLabel = 'Your device data was erased.',
  this.errorLabel = 'Something went wrong. Please try again.',
}) {
  for (final (name, value) in [
    ('title', title),
    ('description', description),
    ('exportLabel', exportLabel),
    ('eraseLabel', eraseLabel),
    ('confirmEraseLabel', confirmEraseLabel),
    ('cancelLabel', cancelLabel),
    ('erasureWarning', erasureWarning),
    ('exportSuccessLabel', exportSuccessLabel),
    ('eraseSuccessLabel', eraseSuccessLabel),
    ('errorLabel', errorLabel),
  ]) {
    if (value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}