gpt4 book ai didi

flutter - SlidingUpPanel 中的 ListView 滚动

转载 作者:行者123 更新时间:2023-12-05 06:01:57 25 4
gpt4 key购买 nike

在 slidingUpPanel 中,我有一个 ListView 小部件。当我尝试滚动时,ListView slidingUpPanel 关闭。如何在不关闭 slidingUpPanel 的情况下滚动 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),
),

我的_summaryWidget

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

最佳答案

您还需要将 sc 放入 ListView Controller 中:

@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"),
);
},
);
}

关于flutter - SlidingUpPanel 中的 ListView 滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67080137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com