如何只滚动具有另一个scrollview的scrollview中的子视图



我有ListView和在singleChildScrollView中有pdf文档包装的孩子只想滚动singleChildScrollView而不是ListView扩张后

下面是我的代码
Column(
children: <Widget>[
Container(
margin: EdgeInsets.only(right: 15, top: 10),
width: size.width,
child: Text("Title should be Pinned",
textAlign: TextAlign.end,
),
),
SizedBox(
height: 20,
),
Theme(
data: ThemeData(
accentColor: Colors.black,
primaryColor: Colors.white24,
),
child: Expanded(
child: ListView.builder(
itemCount: data.length,
itemBuilder: (context, i) => ExpansionTile(
title: Center(
child: Text(
"After Expansion this should be pinned and only children should be scrollable"
),
),
children: [
Container(
child: SingleChildScrollView( //should be scrollable on expanded and not the title of ExpansionTile
child: SfPdfViewer.network(
'$url',
),
),
),
],
),
),
),
)
],
),

让你的小部件在容器中翘曲,并给它一个高度在滚动小部件

中使用以下参数收缩包装:假的,主:真正的

physics:  NeverScrollableScrollPhysics():

将这行添加到您的小部件,然后它将工作

最新更新