listview can not scrolling down inside sliding_up_panel flutter

213 Views Asked by At

I have used panelBuilder to add a ListView and inside ListView, I have used ListView to show my list but when I scrolled down the inside ListView, panel also scrolls down. This is my code.

SlidingUpPanel(
  controller: _panelController,
  maxHeight: _panelHeightOpen,
  minHeight: _panelHeightClosed,
  parallaxEnabled: true,
  parallaxOffset: .5,
  borderRadius: const BorderRadius.only(topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0)),
  color: const Color(0xFFD6EDFF),
  // Maps
  body: Padding(
      padding: EdgeInsets.only(bottom: _paddingBottomMap),
      child: GoogleMap()
  ),
  panelBuilder: (controller) {
    return Builder(builder: (BuildContext context) {
      return ListView(padding: EdgeInsets.zero, controller: controller,
        children: <Widget>[
          //My List
          Container(
            margin: const EdgeInsets.symmetric(horizontal: 20),
            child: const Text("My Favorite")
          ),
          const SizedBox(height: 10),
          Container(
            height: _panelHeightOpen - 370,
            width: double.maxFinite,
            child: ListView.builder(
              controller: _listFavContronller,
              shrinkWrap: true,
              scrollDirection: Axis.vertical,
              itemCount: _favLocation.length,
              itemBuilder: (context, index) {
                return Container(
                    ListTile(
                      onTap: () async {
                        _panelController.close();
                        await goToCurrentLocation();
                      },
                      title: Text("${_favLocation[index].locationName}")
                  )
                );
              }
            )
          )
        ]
      )
    }
  },                                                   
  onPanelSlide: (position) async {
      setState(() {});
  },
  onPanelClosed: () {
    FocusScope.of(context).requestFocus(FocusNode());
  },
))

How do I fix this problem to panel will not scroll down when users scroll the inside ListView down?

Here is Video : https://drive.google.com/file/d/1mOEns6ie3KqRmGXQRenJT560brNjlQni/view?usp=sharing

1

There are 1 best solutions below

2
Mobin Ansar On

In My Case it's working fine for me:

I Have use static itemCount:200

    SlidingUpPanel(
    controller: _panelController,
    maxHeight: _panelHeightOpen,
    minHeight: _panelHeightClosed,
    parallaxEnabled: true,
    parallaxOffset: .5,
    borderRadius: const BorderRadius.only(topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0)),
    color: const Color(0xFFD6EDFF),
    // Maps
    body: Padding(
        padding: EdgeInsets.only(bottom: 10),
        // child: GoogleMap()
    ),
    panelBuilder: (controller) {
      return Builder(builder: (BuildContext context) {
        return ListView(padding: EdgeInsets.zero, controller: controller,
            children: <Widget>[
              //My List
              Container(
                  color: Colors.yellow,
                  margin: const EdgeInsets.symmetric(horizontal: 20),
                  child: const Text("My Favorite")
              ),
              const SizedBox(height: 10),
              Container(
                  color: Colors.blue,
                  height: _panelHeightOpen - 370,
                  width: double.maxFinite,
                  child: ListView.builder(
                      controller: _listFavContronller,
                      shrinkWrap: true,
                      scrollDirection: Axis.vertical,
                      itemCount:200,
                      // itemCount: _favLocation.length,
                      itemBuilder: (context, index) {
                        return Container(
                          color: Colors.red,
                            child: ListTile(
                                onTap: () async {
                                  _panelController?.close();
                                  // await goToCurrentLocation();
                                },
                                // title: Text("${_favLocation[index].locationName}")
                                title: Text("Printed"),
                            )
                        );
                      }
                  )
              )
            ]
        );
}
      );
},
      onPanelSlide: (position) async {
setState(() {});
},
  onPanelClosed: () {
    FocusScope.of(context).requestFocus(FocusNode());
  },
)