[英]Try to create Nested Listview in flutter
i have tried to make nested ListView , the parent list view scrolls in vertical direction and the child list scrolls horizontally but this error are thrown :我试图制作嵌套 ListView ,父列表视图在垂直方向滚动,子列表水平滚动,但抛出此错误:
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracking.dart': Failed assertion: line 301 pos 12: '!_debugDuringDeviceUpdate': is not true.
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] 未处理的异常:'package:flutter/src/rendering/mouse_tracking.dart':断言失败:第 301 行 pos 12:'!_debugDuringDeviceUpdate':不正确。
i also tried to use column with one ListView and other widgets vertically and the same error are thrown我还尝试将列与一个 ListView 和其他小部件垂直使用,并抛出相同的错误
I could solve that by using CustomScrollView Widget and its delegate SliverChildListDelegate(), this part of my code solution我可以通过使用 CustomScrollView Widget 和它的委托 SliverChildListDelegate() 来解决这个问题,这部分我的代码解决方案
CustomScrollView(
slivers: [
SliverList(
delegate: SliverChildListDelegate([
Center(
child: Column(
children: [
Stack(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
// height: MediaQuery.of(context).size.width,
Column(
children: [
InkWell(
onTap: () {},
onHover: (value) {
if (value) {
setState(() {
assetImage =
"assets/DentalChart/1.png";
showHoverImage = true;
hoverText = "Frontal Tooth";
hoverWidth = 100;
hoverHeight = 130;
hoverOffset = Offset(100, 50);
});
} else {
setState(() {
showHoverImage = false;
});
}
},
child: Container(
child: Image.asset(
"assets/Images/1.png",
height: 80,
width: 60,
),
),
),
SizedBox(
height: 10,
),
InkWell(
onTap: () {},
onHover: (value) {
if (value) {
setState(() {
assetImage =
"assets/images/1base.png";
showHoverImage = true;
hoverText = "Tooth Base";
hoverWidth = 80;
hoverHeight = 80;
hoverOffset = Offset(100, 50);
});
} else {
setState(() {
showHoverImage = false;
});
}
},
child: Container(
child: Image.asset(
"assets/images/1base.png",
height: 40,
width: 60,
),
),
),
SizedBox(
height: 10,
),
),
],
),
],
),
Padding(
padding: const EdgeInsets.only(top: 41.0),
child: Text("dsjnkjdvsnkldvsnlkdsn"),
)
],
),
),
]),
)
],
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.