dart - 滚动可滚动小部件时,列内的小部件未完全滚动
问题描述
我有一个NestedScrollView
它的身体包含一个TabBarView
. 其中一个选项卡有一个带有图像的列和一个可滚动的小部件(GridView.builder
)。滚动此可滚动小部件时,图像会卡在中途(就好像它被固定在那个位置一样)。
这是代码
//home.dart
class _HomePage extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Container( //this is the image that gets stuck
child: Column(
children: <Widget>[
new Container(
child: new Image.asset(
"images/product.jpg",
fit: BoxFit.fitWidth,
),
),
Expanded(
child: FreshFinds(), //this is the scrollable widget
),
],
),
);
}
}
// Freshfind.dart
@override
Widget build(BuildContext context) {
return Card(
child: GridView.builder(
// shrinkWrap: true,
itemCount: 50,
physics: ScrollPhysics(),
gridDelegate:
new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
itemBuilder: (BuildContext context, int index) {
return FutureBuilder(
future: fetchdata(index),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (!snapshot.hasData)
return buildfake(index);
else
return buildcard(snapshot.data, index);
},
);
},
),
);
}
解决方案
我认为您需要将SliverAppBar()
小部件与TabBar()
.
推荐阅读
- sql - 尝试注册新用户时出现此错误。'部门编号必须是整数。'
- mysql - MySQL查找最后一次付款是否过期
- python - 在 OpenCV {Python} 上使用 AKAZE 时,Get_MLDB_Full_Descriptor 断言失败
- .net - 我可以知道 $Rumpe 和 $server 的目标是什么吗?
- javascript - 获取字符串部分名称的所有类
- vb.net - 我怎样才能让用户命名文件并输入他\她想要的任何内容?我怎样才能在 vb.net 上做到这一点?
- azure-devops - 我们如何在 Azure DevOps 电子邮件作业状态通知中附加文件
- matlab - 在MATLAB中计算指数加权移动平均值时如何从向量中连续去除异常值?
- java - JavaFX 控制器 - 如何得到他
- r - 整洁模型中交叉验证的 fit_xy() 用法