From 211bd01722bc0a02c66b10305ffcd8a73e67ed33 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Thu, 6 Apr 2023 09:49:21 +0530 Subject: [PATCH] Rebuild 'Location screen' gallery when radius or centerPoint changes --- lib/ui/viewer/location/location_screen.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ui/viewer/location/location_screen.dart b/lib/ui/viewer/location/location_screen.dart index bbd7ff3eb..eaccefdfd 100644 --- a/lib/ui/viewer/location/location_screen.dart +++ b/lib/ui/viewer/location/location_screen.dart @@ -80,6 +80,10 @@ class _LocationGalleryWidgetState extends State { Widget build(BuildContext context) { final selectedRadius = InheritedLocationScreenState.of(context).locationTagEntity.item.radius; + final centerPoint = InheritedLocationScreenState.of(context) + .locationTagEntity + .item + .centerPoint; Future filterFiles() async { final FileLoadResult result = await fileLoadResult; //wait for ignored files to be removed after init @@ -93,10 +97,7 @@ class _LocationGalleryWidgetState extends State { f.location!.longitude != null, ); return !LocationService.instance.isFileInsideLocationTag( - InheritedLocationScreenState.of(context) - .locationTagEntity - .item - .centerPoint, + centerPoint, f.location!, selectedRadius, ); @@ -117,7 +118,8 @@ class _LocationGalleryWidgetState extends State { } return FutureBuilder( - key: ValueKey(selectedRadius), + //rebuild gallery only when there is change in radius or center point + key: ValueKey("$centerPoint$selectedRadius"), builder: (context, snapshot) { if (snapshot.hasData) { return Gallery(