mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
Fix bug with missing year and add date to drag handle (#761)
This commit is contained in:
parent
96b9e37461
commit
87ca031335
3 changed files with 9 additions and 13 deletions
|
@ -22,16 +22,14 @@ class RenderAssetGridElement {
|
||||||
final RenderAssetGridElementType type;
|
final RenderAssetGridElementType type;
|
||||||
final RenderAssetGridRow? assetRow;
|
final RenderAssetGridRow? assetRow;
|
||||||
final String? title;
|
final String? title;
|
||||||
final int? month;
|
final DateTime date;
|
||||||
final int? year;
|
|
||||||
final List<AssetResponseDto>? relatedAssetList;
|
final List<AssetResponseDto>? relatedAssetList;
|
||||||
|
|
||||||
RenderAssetGridElement(
|
RenderAssetGridElement(
|
||||||
this.type, {
|
this.type, {
|
||||||
this.assetRow,
|
this.assetRow,
|
||||||
this.title,
|
this.title,
|
||||||
this.month,
|
required this.date,
|
||||||
this.year,
|
|
||||||
this.relatedAssetList,
|
this.relatedAssetList,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -51,7 +49,7 @@ final renderListProvider = StateProvider((ref) {
|
||||||
if (lastDate == null || lastDate!.month != date.month) {
|
if (lastDate == null || lastDate!.month != date.month) {
|
||||||
elements.add(
|
elements.add(
|
||||||
RenderAssetGridElement(RenderAssetGridElementType.monthTitle,
|
RenderAssetGridElement(RenderAssetGridElementType.monthTitle,
|
||||||
title: groupName, month: date.month, year: date.year),
|
title: groupName, date: date),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +58,7 @@ final renderListProvider = StateProvider((ref) {
|
||||||
RenderAssetGridElement(
|
RenderAssetGridElement(
|
||||||
RenderAssetGridElementType.dayTitle,
|
RenderAssetGridElementType.dayTitle,
|
||||||
title: groupName,
|
title: groupName,
|
||||||
month: date.month,
|
date: date,
|
||||||
year: date.year,
|
|
||||||
relatedAssetList: assets,
|
relatedAssetList: assets,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -73,8 +70,7 @@ final renderListProvider = StateProvider((ref) {
|
||||||
|
|
||||||
final rowElement = RenderAssetGridElement(
|
final rowElement = RenderAssetGridElement(
|
||||||
RenderAssetGridElementType.assetRow,
|
RenderAssetGridElementType.assetRow,
|
||||||
month: date.month,
|
date: date,
|
||||||
year: date.year,
|
|
||||||
assetRow: RenderAssetGridRow(
|
assetRow: RenderAssetGridRow(
|
||||||
assets.sublist(cursor, cursor + rowElements),
|
assets.sublist(cursor, cursor + rowElements),
|
||||||
),
|
),
|
||||||
|
|
|
@ -189,6 +189,7 @@ class ScrollLabel extends StatelessWidget {
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16.0)),
|
borderRadius: const BorderRadius.all(Radius.circular(16.0)),
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: constraints ?? _defaultConstraints,
|
constraints: constraints ?? _defaultConstraints,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
|
@ -257,8 +258,6 @@ class DraggableScrollbarState extends State<DraggableScrollbar>
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Text? labelText;
|
Text? labelText;
|
||||||
if (widget.labelTextBuilder != null && _isDragInProcess) {
|
if (widget.labelTextBuilder != null && _isDragInProcess) {
|
||||||
int numberOfItems = widget.child.itemCount;
|
|
||||||
|
|
||||||
labelText = widget.labelTextBuilder!(_currentItem);
|
labelText = widget.labelTextBuilder!(_currentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ class ImmichAssetGrid extends HookConsumerWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Text _labelBuilder(int pos) {
|
Text _labelBuilder(int pos) {
|
||||||
return Text(
|
final date = renderList[pos].date;
|
||||||
"${renderList[pos].month} / ${renderList[pos].year}",
|
return Text(DateFormat.yMMMd().format(date),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -154,6 +154,7 @@ class ImmichAssetGrid extends HookConsumerWidget {
|
||||||
controller: _itemScrollController,
|
controller: _itemScrollController,
|
||||||
backgroundColor: Theme.of(context).hintColor,
|
backgroundColor: Theme.of(context).hintColor,
|
||||||
labelTextBuilder: _labelBuilder,
|
labelTextBuilder: _labelBuilder,
|
||||||
|
labelConstraints: const BoxConstraints(maxHeight: 28),
|
||||||
scrollbarAnimationDuration: const Duration(seconds: 1),
|
scrollbarAnimationDuration: const Duration(seconds: 1),
|
||||||
scrollbarTimeToFade: const Duration(seconds: 4),
|
scrollbarTimeToFade: const Duration(seconds: 4),
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
|
|
Loading…
Reference in a new issue