flutter - 是否可以在 Flutter 中使用 CustomScrollView 中的 InkWell
问题描述
当我像这样在 CustomScrollView 中嵌入 InkWell 时:
child: SizedBox(
height: 500.0,
child: CustomScrollView(slivers: <Widget>[
InkWell(
onTap: () => {},
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Container(
child: Text(
item.subName == "" ? "Comment" : item.subName,
style: Theme.of(context).textTheme.headline5.copyWith(
fontWeight: FontWeight.w600,
),
),
),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
sliver: viewService.buildComponent("articlelist"),
)
]),
),
),
显示此错误:
======== Exception caught by widgets library =======================================================
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4345 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
The relevant error-causing widget was:
CustomScrollView file:///Users/dolphin/Documents/GitHub/cruise-open/lib/src/page/channel/channeldetail_component/view.dart:96:24
====================================================================================================
我应该在 CustomScrollView 中使用 InkWell 吗?CustomScrollView 只能使用 sliver 组件?我应该怎么做才能解决它?
解决方案
InkWell
尝试包裹SliverToBoxAdapter
推荐阅读
- c# - WebDriverWait 可以用在已经定义的元素上吗?
- python - 如何比较列中的值并使用熊猫创建新列?
- excel - 通过 Excel VBA 将大表格粘贴到单独的幻灯片中
- emacs - 在 babel-execute-subtree 中运行多个块而不回答是
- r - 排列/排序堆积条形图的数据框列
- python - Pandas 错误:isin() 得到了一个意外的关键字参数“case”
- javascript - 如何在 node.js 中发出 post 请求
- xslt - If else 条件使用 BI Publisher RTF
- ios - iOS获取没有DST偏移的时区字符串
- javascript - reactjs航点导入问题