ScenePreloadStatusPanel constructor

ScenePreloadStatusPanel({
  1. Key? key,
  2. required String sceneId,
  3. required ScenePreloadStatus status,
  4. required double progress,
  5. required int itemCount,
  6. bool busy = false,
  7. Future<void> onStart()?,
  8. Future<void> onRetry()?,
  9. VoidCallback? onCancel,
  10. String title = 'Scene assets',
  11. String idleLabel = 'Ready to preload',
  12. String loadingLabel = 'Preparing scene',
  13. String readyLabel = 'Scene ready',
  14. String errorLabel = 'Some required assets failed to load.',
  15. String cancelledLabel = 'Preload cancelled',
  16. String itemCountLabel = 'Assets',
  17. String startLabel = 'Preload',
  18. String retryLabel = 'Retry failed assets',
  19. String cancelLabel = 'Cancel preload',
  20. String actionErrorLabel = 'Action failed. Try again.',
})

Implementation

ScenePreloadStatusPanel({
  super.key,
  required this.sceneId,
  required this.status,
  required this.progress,
  required this.itemCount,
  this.busy = false,
  this.onStart,
  this.onRetry,
  this.onCancel,
  this.title = 'Scene assets',
  this.idleLabel = 'Ready to preload',
  this.loadingLabel = 'Preparing scene',
  this.readyLabel = 'Scene ready',
  this.errorLabel = 'Some required assets failed to load.',
  this.cancelledLabel = 'Preload cancelled',
  this.itemCountLabel = 'Assets',
  this.startLabel = 'Preload',
  this.retryLabel = 'Retry failed assets',
  this.cancelLabel = 'Cancel preload',
  this.actionErrorLabel = 'Action failed. Try again.',
}) {
  if (sceneId.trim().isEmpty) {
    throw ArgumentError.value(sceneId, 'sceneId', 'must not be blank');
  }
  if (itemCount < 0) {
    throw ArgumentError.value(itemCount, 'itemCount', 'must be >= 0');
  }
  if (!progress.isFinite || progress < 0 || progress > 1) {
    throw ArgumentError.value(
      progress,
      'progress',
      'must be finite and in 0..1',
    );
  }
  for (final (name, value) in [
    ('title', title),
    ('idleLabel', idleLabel),
    ('loadingLabel', loadingLabel),
    ('readyLabel', readyLabel),
    ('errorLabel', errorLabel),
    ('cancelledLabel', cancelledLabel),
    ('itemCountLabel', itemCountLabel),
    ('startLabel', startLabel),
    ('retryLabel', retryLabel),
    ('cancelLabel', cancelLabel),
    ('actionErrorLabel', actionErrorLabel),
  ]) {
    if (value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}