diff --git a/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart index aca9729683..1ad7f3a28f 100644 --- a/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart +++ b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart @@ -248,8 +248,6 @@ class ImmichAssetGridViewState extends State { key: ValueKey(section.offset), crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (section.offset == 0 && widget.topWidget != null) - widget.topWidget!, if (section.type == RenderAssetGridElementType.monthTitle) _buildMonthTitle(context, section.date), if (section.type == RenderAssetGridElementType.groupDividerTitle || @@ -289,7 +287,15 @@ class ImmichAssetGridViewState extends State { } Widget _itemBuilder(BuildContext c, int position) { - final item = widget.renderList.elements[position]; + int index = position; + if (widget.topWidget != null) { + if (index == 0) { + return widget.topWidget!; + } + index--; + } + + final item = widget.renderList.elements[index]; return _buildSection(c, item, _scrolling); } @@ -329,7 +335,7 @@ class ImmichAssetGridViewState extends State { itemBuilder: _itemBuilder, itemPositionsListener: _itemPositionsListener, itemScrollController: _itemScrollController, - itemCount: widget.renderList.elements.length, + itemCount: widget.renderList.elements.length + (widget.topWidget != null ? 1 : 0), addRepaintBoundaries: true, );