tp7309 / flutter_sticky_and_expandable_list

粘性头部与分组列表Sliver实现 Build a grouped list, which support expand/collapse section and sticky headers, support use it with sliver widget.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jump scroll to header section

guitar09 opened this issue · comments

Is it possible to scroll the list to a specific index in the header(pinned)?

for example:
scrollControler.jumpTo(sectionIndex);

sorry my bad english

Sorry, the current version does not support jump to specified items. There are the following temporary solutions:

  var _controller = ExpandableListController();
  var _listController = ScrollController();

        onTap: () {
          bool hasSeparator = false;
          int indexInListView = hasSeparator ? sectionIndex * 2 : sectionIndex;
          //get section offset, can not get the offset which not visible on screen.
          double offset = _controller.containerOffsets[indexInListView];
          _listController.animateTo(offset,
              duration: Duration(microseconds: 1000), curve: Curves.linear);
        });

p
where i can associate this value to ExpandableListView?
var _controller = ExpandableListController();

because if i define this variable and print
_controller.containerOffsets;

i received a empty array

see example.

I have added an example of scroll to index.