Programmatically scroll/jump to an element without knowing it's current position
Dimibe opened this issue · 0 comments
Currently it's only possible to use the scroll controller to jump or scroll to a certain index. Since the elements are sorted according to their assigned groups, it's not known on which position in the list the items are displayed.
In order to provide a better way to programmatically jump/scroll to elements inside StickyGroupedList
the scroll controller should be extended to allow scroll/jump without knowing the index of an element.
For this to work, a new parameter is added to the list view with the name elementIdentifier
which is a function which returns the unique identifier for an element. The GroupedItemScrollController
gets two new methods scrollToElement
and jumpToElement
which take a identifier
instead of index
as argument.
StickyGroupedList(
elements: _myElements,
elementIdentifier: (element) => element.contractId,
[...]
);
itemScrollController.jumpToElement(identifier: myElementIdentifier);
Connected issue: grouped_list issue #155