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

[two_dimensional_scrollables] added child position getter #6745

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

faisalansari0367
Copy link

Fixes [two_dimensional_scrollables] childPositionGetter in Tableview.builder #148141

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-05-15.at.21.03.54.mp4

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • [] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@faisalansari0367
Copy link
Author

@Piinks There's a problem with this PR below are the follwoing details:

  • Issue: PR has a problem regarding scrolling too fast.
  • Specific Problem: Missing values, particularly at the top edge of the viewport.
  • Example: When view is out of the viewport, expected value by childPositionGetter should be 0.0, but actual value obtained is 0.2.
  • Solution Goal: Ensure correct values are obtained even when outside the viewport.
  • Proposed Action: Implement measures to prevent this situation, guaranteeing accurate values retrieval.

Please let me know your thoughts on this.
Thanks in adavnce.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @faisalansari0367, thanks for contributing!

Please let me know your thoughts on this.

I am not sure I follow, what is the problem you are trying to solve here? It looks like this PR isn't quite ready for review yet, but it did make me wonder, would it be better to have a getChildOffset type method in the core 2D scrolling classes in the framework? Rather than just in the TableView?

@faisalansari0367
Copy link
Author

Hi @Piinks,

Thanks for your response,

what is the problem you are trying to solve here?

The problem I am trying to solve is to determine the position of an element inside the viewport, which is crucial for developers when creating UIs that are otherwise not possible to achieve.

In the video linked below, to create such UIs where we need to know the position of a widget in the viewport (see the spot price in the video), it's mandatory to determine the position of a child element. Based on that position, we can perform various actions, in this case making the element stick to the top or bottom.

RPReplay_Final1715363832.MP4

would it be better to have a getChildOffset type method in the core 2D scrolling classes in the framework? Rather than just in the TableView?

you raise a great point. While I'm not an expert on the framework's internals, having a getChildOffset type method in the core 2D scrolling classes rather than just in the TableView could be incredibly beneficial. This feature would likely provide more flexibility and power to developers.

Thanks in advance.

@Piinks
Copy link
Contributor

Piinks commented May 21, 2024

Would you like to work on sending a PR that adds the method to the core TwoDimensionalViewport class? What should we do with this PR?

@faisalansari0367
Copy link
Author

Would you like to work on sending a PR that adds the method to the core TwoDimensionalViewport class? What should we do with this PR?

Thank you for the opportunity to contribute! I am interested in working on adding the method to the core TwoDimensionalViewport class. However, I would appreciate some references to help me approach this problem effectively. Specifically, I'd need guidance on the following:

  • Any documentation or pointers to key parts of the codebase that are relevant to this method in TwoDimensionalViewport.
  • Implementation Guidelines: Best practices or examples of similar methods added to core classes in the past.

With these references, I will be able to contribute more efficiently. Thank you!

@Piinks
Copy link
Contributor

Piinks commented May 22, 2024

I am not sure where we might put the method, maybe RenderTwoDimensionalViewport?
The contributing guide should be a good place to start as far as the guidelines you asked about: https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md
Should we close this PR then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants