aves_mio1/lib/remote/remote_view_helpers.dart
FabioMich66 507c131502
Some checks are pending
Quality check / Flutter analysis (push) Waiting to run
Quality check / CodeQL analysis (java-kotlin) (push) Waiting to run
ok2
2026-03-07 23:53:27 +01:00

29 lines
No EOL
914 B
Dart

// lib/remote/remote_view_helpers.dart
import 'package:flutter/material.dart';
import 'remote_http.dart';
import 'package:aves/model/entry/entry.dart';
bool isRemote(AvesEntry e) => e.origin == 1;
bool isVideo(AvesEntry e) {
final mt = (e.sourceMimeType ?? '').toLowerCase();
final p = (e.remotePath ?? e.path ?? '').toLowerCase();
return mt.startsWith('video/') || p.endsWith('.mp4') || p.endsWith('.mov') ||
p.endsWith('.webm') || p.endsWith('.mkv');
}
Future<Widget> remoteImageFull(AvesEntry e) async {
final url = RemoteHttp.absUrl(e.remotePath ?? e.path);
final hdr = await RemoteHttp.headers();
if (url.isEmpty) return const Icon(Icons.broken_image, size: 64);
return InteractiveViewer(
maxScale: 5,
child: Image.network(
url,
fit: BoxFit.contain,
headers: hdr,
errorBuilder: (_, __, ___) => const Icon(Icons.broken_image, size: 64),
),
);
}