Fix scroll bar label showing wrong date if timeline grouped by month

This commit is contained in:
Ming Ming 2024-05-06 21:23:52 +08:00
parent 20120ea90d
commit 5be72240c5

View file

@ -381,8 +381,14 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
.map((e) => e.date)
.sortedBySelf()
.reversed
.groupBy(key: (e) => e)
.map((key, value) =>
.groupBy(key: (e) {
if (prefController.homePhotosZoomLevelValue >= 0) {
return e;
} else {
// month
return Date(e.year, e.month);
}
}).map((key, value) =>
MapEntry(key, (value.length / state.itemPerRow!).ceil()));
final totalRows = dateRows.values.sum;
final midRow = totalRows / 2;