From 142b4a5ade3b803194aa7f7ea66787551a415bf2 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Fri, 3 Apr 2020 10:26:35 +0900 Subject: [PATCH] fullscreen: fix placeholder aspect ratio --- lib/widgets/fullscreen/image_view.dart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/widgets/fullscreen/image_view.dart b/lib/widgets/fullscreen/image_view.dart index ef57e061b..55bbfd558 100644 --- a/lib/widgets/fullscreen/image_view.dart +++ b/lib/widgets/fullscreen/image_view.dart @@ -54,12 +54,18 @@ class ImageView extends StatelessWidget { // if the hero tag wraps the whole `PhotoView` and the `loadingBuilder` is not provided, // there's a black frame between the hero animation and the final image, even when it's cached. - final loadingBuilder = (context) => Image( - image: ThumbnailProvider( - entry: entry, - extent: Constants.thumbnailCacheExtent, + final loadingBuilder = (context) => Center( + child: AspectRatio( + // enforce original aspect ratio, as some thumbnails aspect ratios slightly differ + aspectRatio: entry.displayAspectRatio, + child: Image( + image: ThumbnailProvider( + entry: entry, + extent: Constants.thumbnailCacheExtent, + ), + fit: BoxFit.fill, + ), ), - fit: BoxFit.contain, ); Widget child;