fix(mobile): decode remote thumbnails at displayed size (#29965)

* fix(mobile): decode remote thumbnails at displayed size

* use nullable decode size and reuse the tapped thumbnail in the viewer

* clean up decode size naming and guards
This commit is contained in:
Santo Shakil 2026-08-10 21:14:23 +06:00 committed by GitHub
parent c52bf9995b
commit 9862e50aab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 386 additions and 71 deletions

View file

@ -16,6 +16,7 @@ class ThumbnailTile extends ConsumerStatefulWidget {
const ThumbnailTile(
this.asset, {
this.size = kThumbnailResolution,
this.remoteSize,
this.fit = BoxFit.cover,
this.showStorageIndicator = false,
this.lockSelection = false,
@ -26,6 +27,9 @@ class ThumbnailTile extends ConsumerStatefulWidget {
final BaseAsset? asset;
final Size size;
/// Physical size to decode for remote thumbnails.
final Size? remoteSize;
final BoxFit fit;
final bool showStorageIndicator;
final bool lockSelection;
@ -108,7 +112,7 @@ class _ThumbnailTileState extends ConsumerState<ThumbnailTile> {
// but other solutions have failed thus far.
key: ValueKey(isCurrentAsset),
tag: '${asset?.heroTag}_$heroIndex',
child: Thumbnail.fromAsset(asset: asset, size: widget.size),
child: Thumbnail.fromAsset(asset: asset, size: widget.size, remoteSize: widget.remoteSize),
// Placeholderbuilder used to hide indicators on first hero animation, since flightShuttleBuilder isn't called until both source and destination hero exist in widget tree.
placeholderBuilder: (context, heroSize, child) {
if (!_hideIndicators) {