Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to disable scrolling in SingleChildScrollView

Tags:

flutter

dart

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.

like image 899
kirti Avatar asked Dec 06 '25 08:12

kirti


2 Answers

You can use the following code in your singleChildScrollView.

physics: NeverScrollableScrollPhysics(),

It stops it from being able to scroll.

like image 99
carlosx2 Avatar answered Dec 07 '25 22:12

carlosx2


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,
    )),
like image 23
mabg Avatar answered Dec 08 '25 00:12

mabg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!