From 33fd8f86684fda58cc98b8eb5b60e82aad5df90b Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Wed, 28 Apr 2021 00:27:14 +0530 Subject: [PATCH] Update cached copy of files when widget is udpated --- lib/ui/huge_listview/lazy_loading_gallery.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ui/huge_listview/lazy_loading_gallery.dart b/lib/ui/huge_listview/lazy_loading_gallery.dart index 256432bfd..c14eb8d76 100644 --- a/lib/ui/huge_listview/lazy_loading_gallery.dart +++ b/lib/ui/huge_listview/lazy_loading_gallery.dart @@ -73,6 +73,17 @@ class _LazyLoadingGalleryState extends State { super.dispose(); } + @override + void didUpdateWidget(LazyLoadingGallery oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.files.isEmpty || + widget.files[0].creationTime != _files[0].creationTime) { + setState(() { + _files = widget.files; + }); + } + } + @override Widget build(BuildContext context) { if (_files.length == 0) {