mcrovero / rubber

An elastic material bottom sheet implementation for Flutter.
BSD 2-Clause "Simplified" License
562 stars 88 forks source link

Support multiple ScrollControllers #27

Closed LcTwisk closed 5 years ago

LcTwisk commented 5 years ago

Hello! Thank you so much for this great library. I'm using the bottom sheet in my new app where I have a Navigator with multiple scrolling screens in the bottom sheet: image1 Scrolling is working fine for the first screen, but adding the ScrollController to the ListView of the second screen is throwing this exception: ScrollController attached to multiple scroll views Which makes sense I guess.... Can you think of a way to support multiple ListViews (on different pages, so only one shown at a time) inside a single bottom sheet?

Thanks!

mcrovero commented 5 years ago

This should be already supported but not well documented. When opening the second screen don't use the same scrollController but instead, create a new one and via the RubberBottomSheetState global key change the substituteScrollController property with the new one.

salvatore373 commented 4 years ago

Hi @LcTwisk , I'm trying to implement a UI similar to yours, where I show a ListView of ListItems when the bottom sheet is expanded. I suppose you too are using a ListView for the "Vandaag" section. I put the my ListView inside a Column, but I get the following error: "A RenderFlex overflowed by 1005 pixels on the bottom.". Here is my code:

final content = Material(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            height: 50.0,
            width: 50.0,
            color: Colors.red,
          ),
          ListView.builder(
            shrinkWrap: true,
            itemCount: 40,
            itemBuilder: (context, index) {
              return ListTile(
                title: Text('Title'),
                subtitle: Text('Subtitle'),
                trailing: Text('trailing'),
              );
            },
          )
        ],
      ),
    );

How did you display the ListView in the rubber bottom sheet?

Furthermore I would like to understand what do you mean when you say that you "have a Navigator with multiple scrolling screens in the bottom sheet", because this could be an interesting feature that could be implemented by default in this package.

Thank you for your help! 😊🙏🏼