ScenePreloadStatusPanel constructor
ScenePreloadStatusPanel({
- Key? key,
- required String sceneId,
- required ScenePreloadStatus status,
- required double progress,
- required int itemCount,
- bool busy = false,
- Future<
void> onStart()?, - Future<
void> onRetry()?, - VoidCallback? onCancel,
- String title = 'Scene assets',
- String idleLabel = 'Ready to preload',
- String loadingLabel = 'Preparing scene',
- String readyLabel = 'Scene ready',
- String errorLabel = 'Some required assets failed to load.',
- String cancelledLabel = 'Preload cancelled',
- String itemCountLabel = 'Assets',
- String startLabel = 'Preload',
- String retryLabel = 'Retry failed assets',
- String cancelLabel = 'Cancel preload',
- 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');
}
}
}