【发布时间】:2021-12-25 08:28:59
【问题描述】:
假设我有一个可滚动页面,并且在此页面内我有另一个可滚动列表视图(垂直),所以我希望当子列表视图到达末尾时,可滚动页面开始移动到它的末尾。此外,当子列表视图达到顶部时,可滚动页面开始移动到顶部。怎么会这样?
这是我的代码
Widget FreshProductsShow(double pageHeight, double pageWidth) {
return Container(
height: pageHeight / 1.3,
width: pageWidth,
child: ListView.builder(
itemCount: 10,
itemBuilder: (context, index) {
return Card(
child: Container(
width: pageWidth,
// height: pageHeight / 7,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
textDirection: TextDirection.rtl,
children: [
Image.asset(
"images/peper.png",
width: pageWidth / 4,
height: pageHeight / 8,
),
Padding(
padding: EdgeInsets.only(left: pageWidth / 6.3),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(
left: pageWidth / 10, top: pageHeight / 45),
child: AutoSizeText(
"peper",
style: TextStyle(
fontSize: pageHeight / 48,
fontWeight: FontWeight.bold,
color: Color(0xff54595F)),
),
),
],
),
)
],
),
alignment: Alignment.centerRight,
),
elevation: 5,
);
},
scrollDirection: Axis.vertical,
),
);
}
【问题讨论】:
-
你能把你目前尝试过的code-sn-p包括进来吗?
-
@YeasinSheikh 当然,我编辑了我的问题。如果我想滚动所有页面,我必须点击并滚动此容器之外的某个位置。并且知道如何解决它。
-
在 ListView.builder 中使用主要:false
标签: android flutter dart listview scroll