Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
import 'package:cutdex/l10n/l10n.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cutdex_ui/icons.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
|
|
import '../../workspace/media_availability.dart';
|
|
|
|
class UnavailableMediaPlaceholder extends StatelessWidget {
|
|
const UnavailableMediaPlaceholder({
|
|
super.key,
|
|
required this.availability,
|
|
this.showLabel = true,
|
|
this.isPreview = false,
|
|
});
|
|
final MediaAvailability availability;
|
|
final bool showLabel;
|
|
final bool isPreview;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final label = availability == MediaAvailability.missing
|
|
? context.l10n.mediaMissing
|
|
: context.l10n.mediaUnavailable;
|
|
// Project covers share the canvas background, including missing media.
|
|
return ColoredBox(
|
|
color: isPreview
|
|
? Colors.transparent
|
|
: AppSurfaces.of(context).previewBackground,
|
|
child: Center(
|
|
child: FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
AppIcons.imageUnavailable,
|
|
size: isPreview ? 32 : 24,
|
|
color: theme.colorScheme.error,
|
|
),
|
|
if (showLabel) ...[
|
|
const SizedBox(height: AppSpacing.gap),
|
|
Text(
|
|
label,
|
|
style:
|
|
(isPreview
|
|
? theme.textTheme.bodyMedium
|
|
: theme.textTheme.bodySmall)
|
|
?.copyWith(color: theme.colorScheme.error),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|