mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
Hide scroll handle for lists < 100 assets
This commit is contained in:
parent
8440d9890c
commit
dd71a53f5e
@ -136,10 +136,13 @@ class ImmichAssetGrid extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final scrolling = useState(false);
|
final scrolling = useState(false);
|
||||||
|
|
||||||
|
final useDragScrolling = _assets.length > 100;
|
||||||
|
|
||||||
void dragScrolling(bool active) {
|
void dragScrolling(bool active) {
|
||||||
scrolling.value = active;
|
scrolling.value = active;
|
||||||
}
|
}
|
||||||
@ -148,6 +151,17 @@ class ImmichAssetGrid extends HookConsumerWidget {
|
|||||||
return _itemBuilder(c, position, scrolling.value);
|
return _itemBuilder(c, position, scrolling.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final listWidget = ScrollablePositionedList.builder(
|
||||||
|
itemBuilder: itemBuilder,
|
||||||
|
itemPositionsListener: _itemPositionsListener,
|
||||||
|
itemScrollController: _itemScrollController,
|
||||||
|
itemCount: renderList.length,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!useDragScrolling) {
|
||||||
|
return listWidget;
|
||||||
|
}
|
||||||
|
|
||||||
return DraggableScrollbar.semicircle(
|
return DraggableScrollbar.semicircle(
|
||||||
scrollStateListener: dragScrolling,
|
scrollStateListener: dragScrolling,
|
||||||
itemPositionsListener: _itemPositionsListener,
|
itemPositionsListener: _itemPositionsListener,
|
||||||
@ -157,11 +171,7 @@ class ImmichAssetGrid extends HookConsumerWidget {
|
|||||||
labelConstraints: const BoxConstraints(maxHeight: 28),
|
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: listWidget,
|
||||||
itemBuilder: itemBuilder,
|
);
|
||||||
itemPositionsListener: _itemPositionsListener,
|
|
||||||
itemScrollController: _itemScrollController,
|
|
||||||
itemCount: renderList.length,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user