flutter - 如何仅滚动具有另一个滚动视图的滚动视图内的子项
问题描述
我有 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',
),
),
),
],
),
),
),
)
],
),
解决方案
在容器中扭曲你的小部件并给它一个高度使用滚动小部件内的以下参数
收缩包装:假,主要:真
推荐阅读
- c++ - c ++聚合初始化程序g ++错误?
- sql - Oracle PL/SQL 可以使用动态过程名称吗?
- macos - 升级后无法启动 Android Studio
- python - 如何在 Pycharm 中使用 requests 模块?
- c# - 将两个 Int4 从一个字节读入两个单独的字节,反之亦然
- spring-boot - 在集成测试中注入存储库依赖项是不好的做法
- arduino - 在#define 内相乘会给出奇怪的值
- pytorch - 如何剥离预训练网络并使用 pytorch 闪电添加一些层?
- microsoft-teams - 响应调用时正文始终为空
- javascript - 除非我刷新页面,否则猫头鹰轮播不起作用