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

[scrollable_positioned_list] Add ScrollController to be observed by Scrollbar #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vesuvi88
Copy link

@vesuvi88 vesuvi88 commented Jul 27, 2023

Description

Hello everyone!
I found that the solution proposed in the following PRs (#305, #445) is incorrect, since when scrolling long lists, primary and secondary _ListDisplayDetails are swapped. Therefore, you need to track both Scrollcontrollers.
Therefore, I propose the following fix: attach position primary ScrollController if positions is empty, and detach when changing ScrollControllers. I checked in my project, everything works correctly.

Related Issues

#273
#303
#278
#235
#175
#407

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I signed the CLA.
  • All tests from running flutter test pass.
  • flutter analyze does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

@marcorossitb
Copy link

marcorossitb commented Mar 6, 2024

I tried to use your fork together with a ScrollController linked with a LinkedScrollControllerGroup from 'linked_scroll_controller' package:

@override
void initState() {
  controllers = LinkedScrollControllerGroup();
  contentScroll = controllers.addAndGet();
  fixedScroll = controllers.addAndGet();

  super.initState();
}

// inside build method:
ScrollablePositionedList.separated(
  scrollController: contentScroll,
  ...
)

and it throws the following assertion: "_LinkedScrollControllers can only be used with _LinkedScrollPositions." from:

Any thoughts?

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

Successfully merging this pull request may close these issues.

2 participants