part of '../document_viewer.dart'; class _ProprietaryViewer extends StatelessWidget { final String filename; final Uint8List bytes; final PyramidTheme pt; const _ProprietaryViewer({required this.filename, required this.bytes, required this.pt}); String _fmtSize(int b) { if (b < 1024) return '$b B'; if (b < 1024 * 1024) return '${(b / 1024).toStringAsFixed(1)} KB'; return '${(b / (1024 * 1024)).toStringAsFixed(1)} MB'; } IconData _iconFor(String ext) => switch (ext) { 'psd' || 'psb' => Icons.photo_camera_outlined, 'ai' || 'eps' => Icons.gesture_outlined, 'indd' || 'inx' => Icons.menu_book_outlined, 'afphoto' || 'afdesign' || 'afpub' => Icons.palette_outlined, 'sketch' || 'fig' || 'xd' => Icons.design_services_outlined, 'doc' => Icons.description_outlined, 'ppt' => Icons.slideshow_outlined, 'xls' => Icons.table_chart_outlined, _ => Icons.insert_drive_file_outlined, }; @override Widget build(BuildContext context) { final ext = filename.contains('.') ? filename.split('.').last.toLowerCase() : ''; return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( width: 80, height: 80, decoration: BoxDecoration(color: pt.accentSoft, borderRadius: BorderRadius.circular(pt.rBase)), child: Icon(_iconFor(ext), size: 40, color: pt.accent), ), const SizedBox(height: 16), Text( filename, style: TextStyle(color: pt.fg, fontSize: 15, fontWeight: FontWeight.w600), textAlign: TextAlign.center, ), const SizedBox(height: 6), Text(_fmtSize(bytes.length), style: TextStyle(color: pt.fgDim, fontSize: 13)), const SizedBox(height: 16), Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), decoration: BoxDecoration( color: pt.bg2, borderRadius: BorderRadius.circular(pt.rSm), border: Border.all(color: pt.border), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon(Icons.info_outline_rounded, size: 16, color: pt.fgDim), const SizedBox(width: 8), Text( 'Format kann nicht nativ dargestellt werden', style: TextStyle(color: pt.fgDim, fontSize: 13), ), ], ), ), ], ), ); } }