AnimatedList自动滚动到最后一项并返回
我已经实现了一个动画列表,其中具有这样的slidransition
@override
Widget build(BuildContext context) {
return Expanded(
child: Container(
child: ListView(
children: [
// Other widgets
animatedList(),
],
),
),
);
}
Widget animatedList() {
return AnimatedList(
shrinkWrap: true,
key: _myKeyList,
initialItemCount: _myItemsList.length,
itemBuilder: (context, index, animation) {
return SlideTransition(
position: animation.drive(_offset),
child: _buildMyItemTile[index],
);
},
);
}
,其中_offset变量是一个补间动画。列表的每个项目均以500毫秒的延迟插入和动画。
现在,当将所有项目添加到AnimatedList中时,我希望该AnimatedList内容从第一个项目自动到最后一项(又一次),以显示其所有内容。 我该怎么办?
I've implemented an Animated list with SlideTransition like this
@override
Widget build(BuildContext context) {
return Expanded(
child: Container(
child: ListView(
children: [
// Other widgets
animatedList(),
],
),
),
);
}
Widget animatedList() {
return AnimatedList(
shrinkWrap: true,
key: _myKeyList,
initialItemCount: _myItemsList.length,
itemBuilder: (context, index, animation) {
return SlideTransition(
position: animation.drive(_offset),
child: _buildMyItemTile[index],
);
},
);
}
where _offset variable is a Tween animation. Each item of list is inserted and animated with a delay of 500 milliseconds.
Now, when all items are added to AnimatedList, i would like that AnimatedList content scroll automatically from first item to last (and back) continuously for show all its content.
How can i do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
去做就对了
添加一个控制器
,然后在AnimatedList中添加此控制器,
使函数呼叫最后一个位置或第一个位置
0对于第一个位置,最后一个位置或真实的错误,我不知道,请使用您的想象力,
希望我能帮助您。
Just do it
add a controller
then add this controller in the AnimatedList
Make a function to call the last position or the first
0 for first position and 1 for last position or true false, I don't know, use your imagination
I hope I helped you.