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