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

Added optional param for scrollController #139

Merged

Conversation

jcsena
Copy link

@jcsena jcsena commented Feb 11, 2023

Dear code reviewers,

I am submitting this pull request to add a scroll controller to our trimmer listview widget in Flutter.

The scroll controller is an essential aspect of any scrolling widget, as it allows us to control the position and movement of the listview. In particular, for a trimmer listview, having a scroll controller is crucial to implement features such as adjusting the visible items, or moving to a specific item in the list based on user input.

The scroll controller provides several parameters that can be used to customize the scrolling behavior of the listview, such as:

initialScrollOffset: sets the initial scroll offset when the listview is first displayed.
keepScrollOffset: determines whether the scroll offset is preserved when the widget is rebuilt.
debugLabel: sets a label for the scroll controller, useful for debugging purposes.
By adding a scroll controller to our trimmer listview, we can ensure that the scrolling behavior is consistent, smooth, and easily adjustable. It also enables us to add new functionality that requires a precise control over the scrolling.

Additionally, I would like to bring to your attention that when using the updateTrim(x, 1.0) method, the scroll position may not be modified as expected. To overcome this issue, we need to manually update the scroll position using the jumpTo or animateTo methods provided by the scrollController.

Here's an example of how to use these methods to ensure that the scroll position is updated correctly:

  // Updating the new trim params manual to the end
 _controller.updateTrim(_start, 1.0)

  // Calculate the new scroll offset based on the updated trim value
  double newScrollOffset = ...;
  
  // Animate the scroll position to the new offset
  _scrollController.animateTo(newScrollOffset, duration: Duration(milliseconds: 500), curve: Curves.easeInOut);

I hope you will find this change useful and I look forward to your feedback.

Best regards,

@jcsena jcsena changed the title feat(function): Added optional param for scrollController for trim sl… Added optional param for scrollController Feb 11, 2023
@LeGoffMael
Copy link
Owner

Thank you for your work, i will be happy to accept your PR!
I will check the scroll position issue when using updateTrim() separately

@jcsena
Copy link
Author

jcsena commented Feb 15, 2023

That sounds great!! And better idea!! thanks for your quickly feedback.

@LeGoffMael LeGoffMael changed the base branch from master to feat/scroll-controller February 15, 2023 08:59
@LeGoffMael LeGoffMael merged commit a9e590c into LeGoffMael:feat/scroll-controller Feb 15, 2023
LeGoffMael added a commit that referenced this pull request Feb 15, 2023
@LeGoffMael
Copy link
Owner

Should be now working in scroll-controller branch, i will test it more tomorrow as well before releasing it

@LeGoffMael
Copy link
Owner

sorry for the delay, your feature is available in the latest 2.4.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

Successfully merging this pull request may close these issues.

None yet

3 participants