listview - Is it impossible to have ListView inside SingleChildScrollView?
问题描述
Is it impossible to have ListView
inside SingleChildScrollView
? We trying to create three button which work like radio group button. We have found the solution from Flutter : Custom Radio Button
.
But in our case, it is wrapped by SingleChildScrollView
.
body: SingleChildScrollView(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
Localization.of(context).priority,
style: TextStyle(fontSize: 15.0),
),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: sampleData.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: RadioItem(
sampleData[index],
),
);
},
)
],
)
]))
Error
The following RenderObject was being processed when the exception was fired: RenderShrinkWrappingViewport#4d85f relayoutBoundary=up27 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderShrinkWrappingViewport#4d85f relayoutBoundary=up27 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(unconstrained)
size: MISSING
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#fa7e6(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#d2e68, ScrollDirection.idle)
child 0: RenderSliverPadding#37bf3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: layoutOffset=0.0
constraints: MISSING
geometry: null
padding: EdgeInsets.zero
textDirection: ltr
解决方案
推荐阅读
- javascript - 在角度模板本身中使用全局/窗口变量有什么后果吗?
- wordpress - 重力形式 将输入的数据从第 1 页传递到第 2 页
- reactjs - Azure Graph API 给出错误“身份验证令牌不包含有效权限或用户没有有效角色”
- azure - “www-authenticate →Bearer”带有未经授权的 401
- firebase - -Firebase- 不懂规则
- scala - ElasticSearch:使用代码中的查询更改字段值
- android - 将vectorDrawables与androidx一起使用的更新
- gmail-api - 拦截 gmails/outlook 传入电子邮件以进行进一步检查
- angular - 点击事件 - 我有 3 个手风琴,我想知道如何只使用一种方法一次管理一个事件
- python-3.x - 如何使用 REST 的 put 函数替代 post 函数来保存多个数据?