Paul Raphanaud
Paul Raphanaud

Reputation: 51

Scroll down flutter modal bottomsheet with a scrollview in the sheet

I use the flutter function showmodalbottomsheet to display a page with a customscroll view.

But I have a problem when the scroll of the scrollview is overscrolling I wanted to scroll the the bottomsheet instead of overscrolling the customscrollview.

How can I choose which scroll I want to use?

for example I want to do like Facebook commentary page:

here you can see the sheet is scrolling down when the scrollview is at max scroll

Upvotes: 5

Views: 6364

Answers (1)

kobuchi
kobuchi

Reputation: 450

What you probably need is DraggableScrollableSheet .

showModalBottomSheet(
  isScrollControlled: true,
  context: context,
  builder: (context) => DraggableScrollableSheet(
    builder: (context, scrollController) => SingleChildScrollView(
      controller: scrollController,
      child: Column(
        children: [
          Container(
            color: Colors.purple,
            height: 100,
          ),
          Container(
            color: Colors.orange,
            height: 300,
          ),
          Container(
            color: Colors.black,
            height: 300,
          ),
        ],
      ),
    ),
  ),
),

(I was also looking for an answer when I stumbled upon your question, decided to share the results of my research :) hope it helps you!)

Upvotes: 5

Related Questions