Skip to content

Flutter package: Item builder for ListView,to quickly build header & item & footer,and provide jumpTo(index) function.

License

Notifications You must be signed in to change notification settings

zhahao/list_view_item_builder

Repository files navigation

list_view_item_builder

Item builder for ListView,to quickly build header & item & footer,and provide jumpTo function.

Usage

  • Create an instance of the ListViewItemBuilder.
  • Set the values of itemBuilder and itemCount of _itemBuilder to the ListView.
  ScrollController _scrollController = ScrollController();
  _itemBuilder = ListViewItemBuilder(
        // If you want use [jumpTo] or [animateTo], need set scrollController.
        scrollController:_scrollController,
        rowCountBuilder: (section) => 10,
        itemsBuilder: (BuildContext context, int section, int index) {
                    return Container(
                           height: 44,
                           child: Text('item:${section.toString()}+${index.toString()}'),
                           );
                    },
        );

  ListView.builder(
      itemBuilder: _itemBuilder.itemBuilder,
      itemCount: _itemBuilder.itemCount,
      controller: _scrollController,
    );

  // jumpTo:
  _itemBuilder.jumpTo(int section, int index, {ListViewItemPosition position = ListViewItemPosition.top})

  // animateTo:
  _itemBuilder.animateTo(int section, int index,
      {@required Duration duration,
      @required Curve curve,
      ListViewItemPosition position = ListViewItemPosition.top})

Functions

  • Support header,sectionHeader,item,sectionFooter,footer,loadingMore builder for listView.
  • Support listView jumpTo and animateTo functions by section and index for scroll to position.
  • Support vertical and horizontal scroll direction.

Screenshot

About

Flutter package: Item builder for ListView,to quickly build header & item & footer,and provide jumpTo(index) function.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published