feature: zoom in media viewer

This commit is contained in:
otsmr 2026-02-12 23:28:24 +01:00
parent b59687c5ca
commit 15ae2b5669
5 changed files with 19 additions and 15 deletions

View file

@ -1,5 +1,11 @@
# Changelog # Changelog
## 0.0.92
- Adds option to zoom in received images / videos
- Fixes issue with "reuploaded requested" not working
- Fixes race condition while writing to the log file
## 0.0.91 ## 0.0.91
- Fixes link preview on iOS - Fixes link preview on iOS

View file

@ -218,20 +218,11 @@ Future<void> startDownloadMedia(MediaFile media, bool force) async {
} }
} }
int failCounter = 0;
Future<void> downloadFileFast( Future<void> downloadFileFast(
MediaFile media, MediaFile media,
String apiUrl, String apiUrl,
File filePath, File filePath,
) async { ) async {
if (failCounter < 2) {
failCounter += 1;
await requestMediaReupload(media.mediaId);
return;
}
failCounter = 0;
final response = final response =
await http.get(Uri.parse(apiUrl)).timeout(const Duration(seconds: 10)); await http.get(Uri.parse(apiUrl)).timeout(const Duration(seconds: 10));

View file

@ -378,7 +378,7 @@ Future<void> uploadFileFastOrEnqueue(
try { try {
Log.info('Uploading fast: ${task.taskId}'); Log.info('Uploading fast: ${task.taskId}');
final response = final response =
await requestMultipart.send().timeout(const Duration(seconds: 4)); await requestMultipart.send().timeout(const Duration(seconds: 8));
var status = TaskStatus.failed; var status = TaskStatus.failed;
if (response.statusCode == 200) { if (response.statusCode == 200) {
status = TaskStatus.complete; status = TaskStatus.complete;

View file

@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
import 'package:no_screenshot/no_screenshot.dart'; import 'package:no_screenshot/no_screenshot.dart';
import 'package:photo_view/photo_view.dart';
import 'package:twonly/globals.dart'; import 'package:twonly/globals.dart';
import 'package:twonly/src/database/daos/contacts.dao.dart'; import 'package:twonly/src/database/daos/contacts.dao.dart';
import 'package:twonly/src/database/tables/mediafiles.table.dart' import 'package:twonly/src/database/tables/mediafiles.table.dart'
@ -536,15 +537,22 @@ class _MediaViewerViewState extends State<MediaViewerView> {
children: [ children: [
if (videoController != null) if (videoController != null)
Positioned.fill( Positioned.fill(
child: VideoPlayer(videoController!), child: PhotoView.customChild(
initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained,
child: VideoPlayer(videoController!),
),
) )
else if (currentMedia != null && else if (currentMedia != null &&
currentMedia!.mediaFile.type == MediaType.image || currentMedia!.mediaFile.type == MediaType.image ||
currentMedia!.mediaFile.type == MediaType.gif) currentMedia!.mediaFile.type == MediaType.gif)
Positioned.fill( Positioned.fill(
child: Image.file( child: PhotoView(
currentMedia!.tempPath, imageProvider: FileImage(
fit: BoxFit.contain, currentMedia!.tempPath,
),
initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained,
), ),
), ),
], ],

View file

@ -242,7 +242,6 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
child: VideoPlayerWrapper( child: VideoPlayerWrapper(
videoPath: filePath, videoPath: filePath,
), ),
// childSize: const Size(300, 300),
initialScale: PhotoViewComputedScale.contained, initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained, minScale: PhotoViewComputedScale.contained,
maxScale: PhotoViewComputedScale.covered * 4.1, maxScale: PhotoViewComputedScale.covered * 4.1,