SlidingUpPanel中的ListView滚动



在slidingUpPanel中,我有一个ListView小部件。当我尝试滚动时,ListView slidingUpPanel会关闭。如何在不关闭滑动UpPanel的情况下滚动ListView?

SlidingUpPanel(
controller: _panelController,
maxHeight: _panelHeightOpen,
minHeight: _panelHeightClosed,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50),
topRight: Radius.circular(50),
),
boxShadow: [
BoxShadow(
color: secondaryColor,
spreadRadius: 1,
blurRadius: 5,
offset: Offset(0, -10), // changes position of shadow
),
],
panelBuilder: (sc) => _summaryWidget(sc),
),

我的摘要小工具(_S(

ListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [
Photos(),
],
)

您还需要将sc放在ListView控制器中:

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("SlidingUpPanelExample"),
),
body: SlidingUpPanel(
panelBuilder: (ScrollController sc) => _scrollingList(sc),
body: Center(
child: Text("This is the Widget behind the sliding panel"),
),
),
);
}
Widget _scrollingList(ScrollController sc){
return ListView.builder(
controller: sc,
itemCount: 50,
itemBuilder: (BuildContext context, int i){
return Container(
padding: const EdgeInsets.all(12.0),
child: Text("$i"),
);
},
);
}

最新更新