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

Sticky header not updated on web #202

Open
matteoberla opened this issue Mar 19, 2024 · 2 comments
Open

Sticky header not updated on web #202

matteoberla opened this issue Mar 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@matteoberla
Copy link

Describe the bug
When scrolling down using the mouse and then returning back to the top of the list, the sticky header is not updated correctly and it remains stack to another header. I've noticed that it only happens when the height of the items grouped under an header is lower that a certain amout. (Not sure of the following) This amount seems to be connected to the "step" that the view make each time the mouse wheel is scrolled as it doesn't move row by row, instead it seems to skip some rows.

If i use the lateral bar the problem is not happening, probably because the scroll action is made step by step.
The bug is UI only.

List at startup
list ok

List after scrolling up and down (you see that the first item Ven, 08/03/2024 is repeated two times through the list)
list bug

Expected behavior
I don't know if it's possibile fix this issue as it strictly depends on the mouse that a user is using, but updating the header to the correct one would be nice.

Information:

  • Dart version: Dart 3.3.1
  • Flutter version: Flutter 3.19.3
  • Platform: WEB
  • Package version: grouped_list: ^5.1.2
@matteoberla matteoberla added the bug Something isn't working label Mar 19, 2024
@matteoberla
Copy link
Author

matteoberla commented Mar 27, 2024

find a solution in the initstate on the widget

@override
  void initState() {
    _controller = widget.controller ?? ScrollController();
    if (widget.useStickyGroupSeparators) {
      _controller.addListener(() {
        WidgetsBinding.instance.addPostFrameCallback((_) {
          _scrollListener();
        });
      });
    }
    super.initState();
  }

As the _scrollListener was not receiving the updated data after a scroll action i've added WidgetsBinding.instance.addPostFrameCallback so it waits until the frame is complete and then take the y, max and topElementIndex.

Please add this to fix the issue in the web platform.
I've also tried on mobile and nothing changed, still working perfecty!

matteoberla added a commit to matteoberla/grouped_list that referenced this issue Apr 30, 2024
Sticky header not updated on web Dimibe#202
@matteoberla
Copy link
Author

Please merge my pull request to fix and close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants