2

the effect I want to achieve is that the user scrolls sideways when the user uses the gesture to scroll down. Something like on this page.

ListView does not work with gestures - but it does work with a mouse, but that doesn't solve the problem when the user is using gestures, e.g. on a laptop.

Does anyone have an idea how to handle it?

asked Aug 10, 2020 at 16:35
1
  • Read about Scrollable classes in flutter. It will help you get some clarity, which one to use Commented Aug 10, 2020 at 18:11

1 Answer 1

2

I did not find any dedicated functionality in some widget, but here is my workaround:

final scrollController = ScrollController();
Listener(
 onPointerSignal: (pointerSignal) {
 if (pointerSignal is PointerScrollEvent) {
 scrollController.animateTo(
 scrollController.offset + pointerSignal.scrollDelta.dy,
 curve: Curves.decelerate,
 duration: const Duration(milliseconds: 200),
 );
 }
 },
 child: SingleChildScrollView( // or any other
 controller: scrollController,
 child: ...,
 ),
)
answered May 29, 2021 at 10:57
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.