29 lines
No EOL
914 B
Dart
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),
|
|
),
|
|
);
|
|
} |