如何将分页添加到FirebaseAnimatedList

如何将分页添加到FirebaseAnimatedList,firebase,flutter,Firebase,Flutter,我想用FirebaseAnimatedList分页,但我不知道怎么做。 我将ScrollController设置为controller属性,并且在滚动到顶部时能够收到通知,但我不知道在这之后如何获取其他数据 有人知道如何分页吗 代码: int-limit=15; @凌驾 void initState(){ this.roomId=widget.roomId; listScrollController=new ScrollController()…addListener(_listener); s

我想用
FirebaseAnimatedList
分页,但我不知道怎么做。 我将
ScrollController
设置为controller属性,并且在滚动到顶部时能够收到通知,但我不知道在这之后如何获取其他数据

有人知道如何分页吗

代码:

int-limit=15;
@凌驾
void initState(){
this.roomId=widget.roomId;
listScrollController=new ScrollController()…addListener(_listener);
super.initState();
}
_监听器(){
如果(listScrollController.position.pixels==
listScrollController.position.maxScrollExtent){
//在这里取额外的
}
} 
新柔性(
子级:新的FirebaseAnimatedList(
控制器:listScrollController,
查询:FirebaseDatabase.instance
.reference()
.child(“聊天”)
.儿童(室友)
.limitToLast(limit),
填充:常数边集全部(8.0),
相反:是的,
排序:(a,b)=>b.key.compareTo(a.key),
//比较消息的时间戳以检查哪一个将首先出现
itemBuilder:(构建上下文,DataSnapshot消息快照,
动画(整数索引){
返回新的ChatMessageListItem(
messageSnapshot:messageSnapshot,
动画:动画,
);
},
),
),

遗憾的是,
FirebaseAnimatedList
还不支持分页。您需要为此编写自己的分页登录名,并使用用户
AnimatedList
来显示子项。

谢谢,然后我将采用不同的方法!
int limit = 15;

 @override
  void initState() {
    this.roomId = widget.roomId;
    listScrollController = new ScrollController()..addListener(_listener);
    super.initState();
  }
     _listener() {
        if (listScrollController.position.pixels ==
                listScrollController.position.maxScrollExtent) {
          // fetch additional here
        }
      } 
    new Flexible(
            child: new FirebaseAnimatedList(
              controller: listScrollController,
              query: FirebaseDatabase.instance
                  .reference()
                  .child('chat')
                  .child(roomId)
                  .limitToLast(limit),
              padding: const EdgeInsets.all(8.0),
              reverse: true,
              sort: (a, b) => b.key.compareTo(a.key),
              //comparing timestamp of messages to check which one would appear first
              itemBuilder: (BuildContext context, DataSnapshot messageSnapshot,
                  Animation<double> animation, int index) {
                return new ChatMessageListItem(
                  messageSnapshot: messageSnapshot,
                  animation: animation,
                );
              },
            ),
          ),