From 9a8f0d8606447e29ce54f74f54405d585a2d10de Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Mon, 12 Oct 2020 09:43:18 +0900 Subject: [PATCH] bugfix: failed to show entry when catalog rotation was null --- lib/model/image_entry.dart | 12 ++++++------ lib/widgets/fullscreen/video_view.dart | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/model/image_entry.dart b/lib/model/image_entry.dart index 8a517aa2a..0e5eeccc3 100644 --- a/lib/model/image_entry.dart +++ b/lib/model/image_entry.dart @@ -75,8 +75,8 @@ class ImageEntry { sourceDateTakenMillis: sourceDateTakenMillis, durationMillis: durationMillis, ) - .._catalogMetadata = _catalogMetadata?.copyWith(contentId: copyContentId) - .._addressDetails = _addressDetails?.copyWith(contentId: copyContentId); + ..catalogMetadata = _catalogMetadata?.copyWith(contentId: copyContentId) + ..addressDetails = _addressDetails?.copyWith(contentId: copyContentId); return copied; } @@ -154,7 +154,7 @@ class ImageEntry { // the MIME type reported by the Media Store is unreliable // so we use the one found during cataloguing if possible - String get mimeType => catalogMetadata?.mimeType ?? sourceMimeType; + String get mimeType => _catalogMetadata?.mimeType ?? sourceMimeType; String get mimeTypeAnySubtype => mimeType.replaceAll(RegExp('/.*'), '/*'); @@ -194,7 +194,7 @@ class ImageEntry { } } - bool get portrait => ((isVideo && isCatalogued) ? _catalogMetadata.rotationDegrees : rotationDegrees) % 180 == 90; + bool get portrait => rotationDegrees % 180 == 90; double get displayAspectRatio { if (width == 0 || height == 0) return 1; @@ -220,11 +220,11 @@ class ImageEntry { return _bestDate; } - int get rotationDegrees => catalogMetadata?.rotationDegrees ?? sourceRotationDegrees; + int get rotationDegrees => _catalogMetadata?.rotationDegrees ?? sourceRotationDegrees ?? 0; set rotationDegrees(int rotationDegrees) { sourceRotationDegrees = rotationDegrees; - catalogMetadata?.rotationDegrees = rotationDegrees; + _catalogMetadata?.rotationDegrees = rotationDegrees; } int get dateModifiedSecs => _dateModifiedSecs; diff --git a/lib/widgets/fullscreen/video_view.dart b/lib/widgets/fullscreen/video_view.dart index e28bec1fc..3390111ba 100644 --- a/lib/widgets/fullscreen/video_view.dart +++ b/lib/widgets/fullscreen/video_view.dart @@ -80,7 +80,7 @@ class AvesVideoState extends State { color: Colors.black, ); - final degree = entry.catalogMetadata?.rotationDegrees ?? 0; + final degree = entry.rotationDegrees ?? 0; if (degree != 0) { child = RotatedBox( quarterTurns: degree ~/ 90,