1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(mobile): Empty albums don't show title (#3576)

This commit is contained in:
X 2023-08-13 21:39:46 +08:00 committed by GitHub
parent 60d39a7d1f
commit 5fa9704a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -248,8 +248,6 @@ class ImmichAssetGridViewState extends State<ImmichAssetGridView> {
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<ImmichAssetGridView> {
}
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<ImmichAssetGridView> {
itemBuilder: _itemBuilder,
itemPositionsListener: _itemPositionsListener,
itemScrollController: _itemScrollController,
itemCount: widget.renderList.elements.length,
itemCount: widget.renderList.elements.length + (widget.topWidget != null ? 1 : 0),
addRepaintBoundaries: true,
);