简体   繁体   中英

Not able to disable scrolling in SingleChildScrollView

I am using a SingleChildScrollView and when tapping on FormTextField in it, the keyboard appears and the scroll view is scrolled upwards. After dismissing the keyboard, I am still able to scroll the Scrollview manually. Can you please suggest any solution to disable the manual scrolling after FormTextField disappears.

You can use the following code in your singleChildScrollView.

physics: NeverScrollableScrollPhysics(),

It stops it from being able to scroll.

In my case, when I put physics: NeverScrollableScrollPhysics() SingleChildScrollView can't be scrolled, but a scroll bar appears. If I use the scroll bar, the content is scrolled.

I need to hide the scroll bar:

ScrollConfiguration(
    behavior:
        ScrollConfiguration.of(context).copyWith(scrollbars: false),
    child: SingleChildScrollView(
        physics: const NeverScrollableScrollPhysics(),
        child: child,
    )),

I think we have the same problem. I use two settings in singleChildScrollView

physics: NeverScrollableScrollPhysics(), reverse: true,

This solution is acceptable to me, I hope it is good for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM