Animating changes in a SliverList

后端 未结 2 1809
梦毁少年i
梦毁少年i 2021-02-12 18:33

I currently have a SliverList whose items are loaded dynamically. The issue is that once these items are loaded, the SliverList updates without animati

相关标签:
2条回答
  • You could Wrap your list items in an AnimatedWidget

    Read about it in the docs AnimatedWidget

    0 讨论(0)
  • 2021-02-12 19:23

    I have a workaround for using a simple ListView with a Sliver. It's not perfect and it has limitations, but it works for the case where you just have 2 Slivers, the AppBar and a SliverList.

    NestedScrollView(
      headerSliverBuilder: (_, _a) => SliverAppBar(<Insert Code Here>),
      body: MediaQuery.removePadding(
        removeTop: true, 
        context: context, 
        child: AnimatedList(
          <InsertCodeHere>
        )))
    

    You can tweak around with the Widget tree, but that's the basic idea. Wrap the sliver appbar in a NestedScrollView and place the List in the body.

    0 讨论(0)
提交回复
热议问题