Flutter Development: Manually Scrolling a ListView to the Bottom
I searched for this problem for a long time and couldn't find it. There doesn't seem to be much Flutter research in China yet, but Stack Overflow is truly all-powerful. Recording it here~ Original Use ScrollController.jumpTo() or ScrollController.animateTo() method to achieve this. Here is code snippet (After 1 second, the ListV
目录2 个章节
I searched for this problem for a long time and couldn't find it. There doesn't seem to be much Flutter research in China yet, but Stack Overflow is truly all-powerful. Recording it here~
Original
Use
ScrollController.jumpTo()orScrollController.animateTo()method to achieve this. Here is code snippet (After 1 second, theListViewwill scroll to the bottom) by CopsOnRoad
class _HomePageState extends State<HomePage> {
ScrollController _controller = ScrollController();
@override
Widget build(BuildContext context) {
Timer(Duration(milliseconds: 1000), () => _controller.jumpTo(_controller.position.maxScrollExtent));
return ListView.builder(
controller: _controller,
itemCount: 50,
itemBuilder: (context, index) => ListTile(title: Text("ListTile"),));
}
}
Welcome to Discuss
If you have questions, please leave a message in the WeChat official account backend. I'll reply to every message~
- WeChat Official Account: 画星星高手
- Coding livestream: https://live.bilibili.com/11883038
- Zhihu: https://www.zhihu.com/people/dealiaxy
- Jianshu: https://www.jianshu.com/u/965b95853b9f
_EOF_
Flutter Development: Manually Scrolling a ListView to the Bottom
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
初见Flutter!框架简单介绍以及构建可发布的签名Apk包
哈喽!好久不见,算起来我已经一个多月没更新博客了,近期刚刚完成了一个项目,正好抽出时间整理一下学到的东西并且写写博客。 关于flutter 开始使用flutter还是春节后的事情,其实之前很早就想学一下flutter了,毕竟谷歌出的技术总是不会太差的,无奈一直没有时间和做app的需求,这次接触了flutter之后仿佛发现了新大陆,原来开发app还能这么方便,真的颠覆了我原来的认知啊,热更新也太好用
2021-12-18 · Flutter · 约 1 分钟
Flutter播放音乐简单解决方案-AudioPlayers-与填坑
目前flutter播放音乐好像只搜到AudioPlayers这个解决方案,我照着他的文档来,确实是可以播放音乐的。 项目主页:https://pub.flutter-io.cn/packages/audioplayers AudioCache介绍:https://github.com/luanpotter/audioplayers/blob/master/doc/audio_cache.md An
2021-12-18 · Flutter · 约 1 分钟
Flutter移动应用快速构建实践——状态管理、国际化、数据持久化、性能优化(二)
继续上一篇:极简诗词开发背后:Flutter移动应用快速构建实践——状态管理、国际化、数据持久化、性能优化(一) 前文中说到了项目结构、状态管理和国际化的方案,本文继续聊聊数据持久化和粗略的性能优化。 数据持久化 目前的话,flutter用的比较多比较成熟的数据持久化就是shared_preferences和SQFLite,一个是ini配置文件,一个是SQLite数据库,小应用我比较倾向只用前者,
2021-12-18 · Flutter · 约 1 分钟
Flutter编译失败:java-nio-file-NoSuchFileException--build-app-intermediates
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:mergeExtDexDebug'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$Acti
2021-12-18 · Flutter · 约 1 分钟
讨论
共 0 条加载评论中…