Stop scrolling in DraggableScrollableSheet in flutter

Viewed 1732

I would like to stop the inside of my DraggableScrollableSheet from scrolling while still being able to drag it up and down. Is there a way to do that? I've used a bottomSheet but they were unable to be dragged up and down.

I'd like to stay away from third party code, so if there is a way to do it natively that would be amazing. Here's an example of what is currently happening:

enter image description here

Here is my relevant code:

@override
Widget build(BuildContext context) {
    return Scaffold(
        drawer: SettingsDrawer(username: _username),
        body: Stack(
            children: <Widget>[
                MapWidget(),
                MenuButton(),
                DraggableScrollableSheet(
                    initialChildSize: 0.35,
                    minChildSize: 0.2,
                    maxChildSize: .35,
                    builder: (BuildContext context, ScrollController scrollController) {
                         return SingleChildScrollView(
                           controller: scrollController,
                           child: HelpSheet(),
                         );
                   },
                )
            ]
        ),
    );
}
2 Answers

I decided to go with SlidingUpPanel instead of trying to to it natively.

SlidingUpPanel(
    maxHeight: 350.0,
    minHeight: 150.0,
    parallaxEnabled: true,
    parallaxOffset: .1,
    panel: HelpSheet(),
    borderRadius: BorderRadius.only(
    topLeft: Radius.circular(18.0),
    topRight: Radius.circular(18.0)
),

You can try by adding NeverScrollableScrollPhysics() to SingleChildScrollView as follows,

...    

return SingleChildScrollView(
  physics: NeverScrollableScrollPhysics(),
  controller: scrollController,
  child: HelpSheet(),
);

...
Related