init method

void init()

初始化上拉刷新

  @override
  Widget build(BuildContext context) {
    print("object build");
    _listBuilder = ListBuilder(
      list: array,
      scrollController: ScrollController(),
      voidCallback: () {
        print("voidCallback update list");
        setState(() {
          array = List.generate(20, (index) => MessItem(name: "name-new$index"));
        });
      }
    )..init();  // 加载此功能
    return _listBuilder.build();
  }

Implementation

void init() {
  scrollController?.addListener(() {
    if (scrollController?.position.pixels ==
        scrollController?.position.maxScrollExtent) {
      // 最底部时加载数据。
      _onLoadMore();
      isLoading = true;
    }
  });
}