Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When list is being used in reverse then jumpTo/scrollTo index 0 fails, it always takes you to index 1 #52

Open
ps9310 opened this issue Aug 30, 2022 · 0 comments

Comments

@ps9310
Copy link

ps9310 commented Aug 30, 2022

Following is my code snippet

StickyGroupedListView<Message, DateTime>(
  reverse: true,
  floatingHeader: true,
  elements: state.messages,
  order: StickyGroupedListOrder.DESC,
  itemScrollController: groupedItemScrollController,
  itemPositionsListener: itemPositionsListener,
  elementIdentifier: (message) => message.msgId,
  itemComparator: (a, b) => (a.dateTime).compareTo(b.dateTime),
  groupBy: (msg) => DateTime(msg.dateTime.year, msg.dateTime.month, msg.dateTime.day),
  groupSeparatorBuilder: (message) {
    return Text('Header');
  },
  itemBuilder: (context, message) {
    return Text('Message');
  },
)

Whenever user adds a new message, I'm calling following code to take user to first message in chat, which is taking me to index 1 instead of 0.

groupedItemScrollController.jumpTo(index: 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant