daf4cf3dad
Sechster Durchgang derselben part/part-of-Technik wie bei den 5 vorigen Umbauten - reine Verschiebung, keine Logikänderung. document_viewer.dart schrumpft von 1773 auf 20 Zeilen (nur noch Bibliothekskopf), 34 Top-Level-Bloecke (31 Klassen/Enums + 3 lose Funktionen) auf 5 thematische Dateien unter lib/features/chat/document/ verteilt. Verifiziert per automatisiertem Blockvergleich gegen das Original und flutter analyze (weiterhin nur 1 bekannter Hinweis). voice_channel.dart und app_shell.dart bewusst nicht angefasst - haengen an der noch unentschiedenen Call-Fassade bzw. dem Bootstrap/Login-Pfad. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
72 lines
2.7 KiB
Dart
72 lines
2.7 KiB
Dart
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),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|