import 'package:cutdex/l10n/l10n.dart'; import 'package:flutter/material.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( Icons.broken_image_outlined, 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), ), ], ], ), ), ), ); } }