flutter - GridView builder和carousal不会在颤动中滚动
问题描述
我正在尝试滚动屏幕的整个主体,我有一个旋转和网格视图,但我不能这样做:这是我到目前为止所做的:
Scaffold(
appBar: const TopNavBar(),
// here i am adding SingleScrollChildView() widget to scroll the whole page, instead of just grid widget, but it gives error
body: Column(
children: [
MainCarousal(), // carousal widget from carousel_slider
Flexible(
child: GridView.builder(
itemCount: state.products.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
itemBuilder: (listContext, index){
return Container(
decoration: BoxDecoration(
color: const Color(0xffeeeeee),
borderRadius: BorderRadius.circular(10),
),
);
child: Text(state.products[index].name),
);
),
),
代码本身没有错误,并且滚动适用于网格数据。但我想向下滚动整个页面,以便网格项可见。但是当我添加SingleScrollView
到该列时,它给了我错误:
RenderFlex 子项具有非零弹性,但传入的高度约束是无界的。
解决方案
推荐阅读
- c# - Microsoft 记录单行
- javascript - 如何渲染条件样式(React + Sass)
- flutter - 如何拥有一个与 appbar 宽度相同的按钮?
- java - 为什么双击自定义按钮会使android应用程序崩溃
- r - 根据 R 中另一个向量中定义的数值位置查找向量的元素
- linkedin - 在我们的网站中获取linkedIn API以进行linkedin集成的程序是什么
- javascript - 您可以阻止在浏览器中加载 PDF javascript 吗?
- swift - 根据条件选择segue
- node.js - 我不确定为什么在这个简单的例子中调试器行没有被命中
- python - 使用 python-pptx 自动重新排列 powerpoint 幻灯片