added a swipeable media gallery for chat and folder images and videos with server previews, on-demand originals and zoom, and marked document previews in chat so they no longer pass for photos

This commit is contained in:
MineTec committed 2026-10-28 22:15:57 +01:00
1 parent 952f916231
commit aa176c90e3
22 files changed
+1658 -103

No files matched your search

+23
View File
@@ -58,6 +58,29 @@ const Set<String> _textExtensions = {
'srt', 'vtt',
};
/// Further raster formats the gallery shows. They decode via the platform
/// codecs (HEIC/AVIF) or are JPEG/ICO under another name. SVG and TIFF stay
/// out: without a server preview only the file viewer can render them.
const Set<String> _galleryOnlyImageExtensions = {
'heic',
'heif',
'avif',
'jfif',
'jpe',
'ico',
};
/// Extension-only check (no content sniff) for files the media gallery can
/// page through — the fallback when no MIME type is known.
bool isGalleryImageName(String name) {
final ext = name.split('.').last.toLowerCase();
return _imageExtensions.contains(ext) ||
_galleryOnlyImageExtensions.contains(ext);
}
bool isGalleryVideoName(String name) =>
_videoExtensions.contains(name.split('.').last.toLowerCase());
/// Detects the [FileKind] of the file at [path] from its extension, falling
/// back to an 8 KB content sniff ([_looksLikeText]) for unknown extensions.
Future<FileKind> detectFileKind(String path) async {