diff --git a/lib/ui/detail_page.dart b/lib/ui/detail_page.dart index 01da76bea4f64a62d94a881e657e0e9b73cb1891..45c993b38e2fdf73ef010c1598506cf2596e1ffa 100644 --- a/lib/ui/detail_page.dart +++ b/lib/ui/detail_page.dart @@ -35,8 +35,8 @@ class _DetailPageState extends State { @override Widget build(BuildContext context) { Logger().i("Opening " + - _photos[_selectedIndex].title + - ", " + + _photos[_selectedIndex].toString() + + ". " + _selectedIndex.toString() + " / " + _photos.length.toString() + diff --git a/lib/ui/gallery.dart b/lib/ui/gallery.dart index 62c302d9bbc2ab9d7d99b9aaa067164c275e026d..855972eaaedecbdea6cabd6c0c7f8c69ec046992 100644 --- a/lib/ui/gallery.dart +++ b/lib/ui/gallery.dart @@ -40,6 +40,7 @@ class _GalleryState extends State { // TODO: Investigate reason for multiple rebuilds on selection change _photos = widget.photos; _selectedPhotos = widget.selectedPhotos; + _deduplicatePhotos(); _collatePhotos(); return ListView.builder( @@ -136,6 +137,16 @@ class _GalleryState extends State { ); } + void _deduplicatePhotos() { + for (int index = 1; index < _photos.length; index++) { + final current = _photos[index], previous = _photos[index - 1]; + if (current.localId == previous.localId) { + _photos.removeAt(index); + index--; + } + } + } + void _collatePhotos() { final dailyPhotos = List(); final collatedPhotos = List>();