0

My flutter SingleChildScrollingView widget exposes live logs and can become quite long.

I'd like to provide the user a mean to temporarily freeze the scroll so that he can examine the log. He will then toggle back to scroll when done.

How to do that?

return SingleChildScrollView(
  physics: BouncingScrollPhysics(),
  padding: EdgeInsets.all(contentPadding),
  child: Column(children: [
    // blah blah
  ]
);
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
  • 2
    Does this answer your question? [Flutter: ListView disable scrolling with touchscreen](https://stackoverflow.com/questions/50477809/flutter-listview-disable-scrolling-with-touchscreen) – OMi Shah Jan 20 '23 at 09:12
  • 2
    ``physics: scrollEnabled ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(),`` – OMi Shah Jan 20 '23 at 09:13

1 Answers1

0

Once try with this demo.

define Variable for manage Scroll

 bool isScrolling = true;

Scroll View

SingleChildScrollView(
        physics: isScrolling ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            FloatingActionButton(
              onPressed: () {
                setState(() {
                  isScrolling = !isScrolling;
                });
              },
              tooltip: "Scroll Start And Stop",
              child: Icon(isScrolling ? Icons.play_arrow : Icons.pause),
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),

You can true where you want to scrolling and you can false for pause screen.

I hope this things are solve your issue.

Romil Mavani
  • 376
  • 6