返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
Flutter

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

曦远 (DealiAxy)约 4 分钟
目录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() or ScrollController.animateTo() method to achieve this. Here is code snippet (After 1 second, the ListView will 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~

_EOF_

Flutter Development: Manually Scrolling a ListView to the Bottom

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

把爬虫放到手机上跑!Flutter爬虫框架初探~

最近做毕设需要大量数据训练模型,很多网站又要反爬机制,得爬一会停一会,所以特别慢,要是我用电脑24小时爬虫太费电了,于是想到利用手机~ 然后就想到flutter,安卓苹果旧手机都能利用起来做数据采集。 ok,然后就开始做,折腾了一天做了一个大概的框架。总算可以方便的添加爬虫任务了,集成了配置、日志、数据持久化这些基本的功能,然后封装网络请求、网页解析的功能,用起来还行。 只不过众所周知的,dart

2021-12-18 · Flutter · 约 1 分钟

使用Flutter设计一个好看的_我_页面

近期遇到一些很烦的琐事,状态比较down,很多原本计划好的事情都耽搁了,实在是难顶…… 看到后台一直有朋友问怎么博客和公众号没有更新,所以我忙完得闲就来更了! 前言 起因是最近重拾以前的旧项目(业余做的,打算有机会自己运营起来)继续完善,然后发现有些界面设计太粗糙了,实在不满意~~(虽然是因为本来功能就不多)~~,然后就着手开始优化~ 应该会写成一系列文章,今天就从App的"我"页面开始吧~ 效果

2021-12-18 · Flutter · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…