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

scrollTo, jumpTo to the last index #39

Open
dmk3141618 opened this issue Feb 9, 2022 · 6 comments
Open

scrollTo, jumpTo to the last index #39

dmk3141618 opened this issue Feb 9, 2022 · 6 comments

Comments

@dmk3141618
Copy link

If I try to jumpTo the last index

groupedItemScrollController.jumpTo(index: items.length - 1);

Can not scroll to the item because there isn't any padding on the bottom.

So it is flickering.

Even it is not the last index, some item in the middle of the end page's position, it can not scroll to that item.
Scroll will try to forcibly scroll to it but can not reach because it is already bottom of the total items.

So I think it needs

  1. some methods to get whether it is now on the limit of the scroll. (calculated from the item index)
  2. scroll to bottom. the bottom means the end of the items.
@eul
Copy link

eul commented May 20, 2022

How can I scroll to the last item?
I used animateTo(0.0,duration: Duration(milliseconds: 300), curve: Curves.easeOut); with ListView

@anthonycuervo23
Copy link

how to scroll to last index Im having same issue where I dont have enough space to scroll to last items and it bounce back to the top

@waqadArshad
Copy link

@anthonycuervo23 @eul @dmk3141618 Try this:

  groupedItemScrollController.scrollTo(
      index: itemPositionsListener.itemPositions.value.last.index,
      duration: Duration(milliseconds: 100),
  );

Please remember to add this:

itemPositionsListener: itemPositionsListener, 

to your StickyGroupedListView after its declaration, like this:

  ItemPositionsListener itemPositionsListener = ItemPositionsListener.create();

after adding

  scrollable_positioned_list: ^0.2.3

to your pubspec.yaml

@anthonycuervo23
Copy link

Thanks @waqadArshad but I still face the same behavior no matter if is the first or last index

Screen_Recording_2022-06-23_at_11_20_53_PM_AdobeExpress

@anthonycuervo23 @eul @dmk3141618 Try this:

  groupedItemScrollController.scrollTo(
      index: itemPositionsListener.itemPositions.value.last.index,
      duration: Duration(milliseconds: 100),
  );

Please remember to add this:

itemPositionsListener: itemPositionsListener, 

to your StickyGroupedListView after its declaration, like this:

  ItemPositionsListener itemPositionsListener = ItemPositionsListener.create();

after adding

  scrollable_positioned_list: ^0.2.3

to your pubspec.yaml

@waqadArshad
Copy link

@anthonycuervo23 Hi, what do u mean by "where I dont have enough space to scroll to last items". I mean why don't u have space to scroll to last item? it's a listView

@asadamatic
Copy link

I was able to resolve this issue assigning bottom padding to StickGroupedListView.

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

5 participants