You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScrollView/Draggable that allows scrolling in both directions (x, y) with overscroll physics #20175
It's quite difficult to do this with the current classes, as classes like ScrollPosition, Scrollable and ScrollContext only support one scroll direction.
The biggest problem I hit so far is that ScrollPosition stores it state directly in ScrollContext.storageContext, without a key. So when you have two ScrollPositions in a single widget (one for each axis), those will override each other when the scroll offset is saved.
Spent the better part of a day trying to get this setup and it feels like this is too far upstream in Flutter to make this a simple task for a layman. Requesting suggestions from team members for a strategy for making a PR against this issue. My immediate goal is to create a 2d PageView with user defined keep-alives for heavyweight children like maps/videos.
My plan was to take the GestureTransformable widget from that 2D Transformations gallery demo and move it into the main widgets/ directory with a few improvements and tests.
I tried to write it in a way that it could easily be made into a first party widget, but there was more work I wanted to do to split it up to make it more reusable and generic. I started working on that in this branch but haven't had time to finish it. Ideally I wanted to split out a core public widget that accepted a Matrix4 as a parameter and reported gestures on the transformed child, but didn't modify the matrix itself. Then I wanted a higher level public widget that used the core one internally and worked more or less like GestureTransformable does in that demo.
I won't get to this myself for awhile, so if you want to take that code and turn it into a first party widget yourself, please do!
came here while searching for something similar what OP asked for:
I have a PageView and want to be able to transform its children while scrolling according to the dx (on horizontal scroll) movements.
I tried using a RawGestureDetector with a custom PanGestureRecognizer, but that comes of the price of no longer having the BouncingScrollPhysics and the need to manually implement fling gestures etc...
@justinmc I looked at your GestureTransformable widget but it bugs me if there isn't a more simple solution than that for my specific use case... maybe you have an idea?:
It seems to me the easiest solution would be - while keeping all benefits of ListView/PageView and Physics - if ListView and PageView would register the user input movements (the drag) along their cross-axis.
hey @lukepighetti & thanks! But on your answer I see that I misdescribed the problem: I want the cross-axis value of a scrollable! On a PageView that'd be the dy (when in default Axis.horizontal) ...
Has anybody been able to make progress on this? I want to make an EPG (electronic/television programme guide) style layout but there doesn't seem to be anything out there that do it.
Yes actually, this is in progress and coming soon! Here's the WIP PR: #44015
I've mainly been thinking of that widget being used for photo viewers, etc. I'm not sure how well it will cover this use case, but if you think it will, let me know if there's anything I can do to accommodate.
Reacted by LK, mono — Masayuki Ono, Michał Kuklis, Milen Marinov, Tony Thomas, Andy Muir and Pavel Denisov
That's great news @justinmc - I've been hoping for something like this for some time (see 23457).
My use case is similar to @l-k22 's: I need to put lots of custom sized boxes on the display, and be able to scroll about and zoom. The number and sizes of boxes will be dynamic.
I see your PR is nearly there, so I'll wait for it and give it a try out. :)
I'd like something similar for ListView. I have a list of items, but they can overflow the width so I want the list to be horizontally scrollable too. I did try wrapping the entire list in a horizontal ScrollView but it gave me errors about unbounded sizes. Maybe it works with a few more widgets but I feel like you should just be able to tell ListView to make the cross-axis scrollable.
@muirandy I'm glad this will be useful! I'm interested to see how the dynamic size of the boxes will work with this. Let me know once it's merged and you try it out.
@Timmmm Currently ListView can't scroll both axes. This seems like something that should be doable with InteractiveViewer though. I'll try to specifically try it out. See this table example I made:
Reacted by mono — Masayuki Ono, DiamNet, Marcos Garcés and Gilyazeev Adel
I need such a widget especially for using in Flutter Web. #49109 You can check this issue.
It must have a smooth scrolling for both directions. Also, a bool property for locking the scroll direction after the scroll direction detected. (If it is horizontal, lock it to be scrolled only horizontally, else to be scrolled only vertically. This should be optional. Of course, the default behavior must be both directions. )
Cells should be rendered on-demand as ListView.builder does. Otherwise, there will be a huge performance loss.
@justinmc Great news to hear! I really appreciate your work and am very thankful.
EDIT: By the way, there is already a package related to this. However, it lacks the features I request.
@yasinarik Thanks for letting me know you need this, I was hoping to get some feedback like this. I think your first bullet point should be fairly straightforward. I'll try to include it in my PR.
The second bullet point will be a bit trickier, but I imagine it should be doable just like ListView.builder... I won't be able to include it in the initial PR, but I think it's something we that would make sense to add afterwards.
Reacted by Yasin Arık, Modestas Valauskas, Bao Bo, legut2, DiamNet, tegezc and Pavel Denisov
@justinmc is there anyway in which in the computer i could say that the scroll wheel is for scrolling and then to zoom I have to press control + scroll wheel?
@marcosagni98 Unfortunately you'll have to hack your own InteractiveViewer to achieve that right now. At this line the pointer scroll is hard coded to do a scale.
We should make it possible to customize that though... I'm not sure how we could cleanly do that.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
justinmc commentedon Jan 29, 2019
I'm currently working on a demo for the gallery that shows how to do this. I hope to turn it into its own widget after I get that merged. #25164
lukepighetti commentedon Sep 6, 2019
Spent the better part of a day trying to get this setup and it feels like this is too far upstream in Flutter to make this a simple task for a layman. Requesting suggestions from team members for a strategy for making a PR against this issue. My immediate goal is to create a 2d PageView with user defined keep-alives for heavyweight children like maps/videos.
justinmc commentedon Sep 11, 2019
My plan was to take the GestureTransformable widget from that 2D Transformations gallery demo and move it into the main
widgets/directory with a few improvements and tests.I tried to write it in a way that it could easily be made into a first party widget, but there was more work I wanted to do to split it up to make it more reusable and generic. I started working on that in this branch but haven't had time to finish it. Ideally I wanted to split out a core public widget that accepted a
Matrix4as a parameter and reported gestures on the transformed child, but didn't modify the matrix itself. Then I wanted a higher level public widget that used the core one internally and worked more or less like GestureTransformable does in that demo.I won't get to this myself for awhile, so if you want to take that code and turn it into a first party widget yourself, please do!
Tobbyte commentedon Sep 16, 2019
came here while searching for something similar what OP asked for:
I have a PageView and want to be able to transform its children while scrolling according to the dx (on horizontal scroll) movements.
I tried using a RawGestureDetector with a custom PanGestureRecognizer, but that comes of the price of no longer having the BouncingScrollPhysics and the need to manually implement fling gestures etc...
@justinmc I looked at your GestureTransformable widget but it bugs me if there isn't a more simple solution than that for my specific use case... maybe you have an idea?:
It seems to me the easiest solution would be - while keeping all benefits of ListView/PageView and Physics - if ListView and PageView would register the user input movements (the drag) along their cross-axis.
lukepighetti commentedon Sep 16, 2019
@apptum, this might be helpful for extracting DX for a single page inside a pageview
Tobbyte commentedon Sep 17, 2019
hey @lukepighetti & thanks! But on your answer I see that I misdescribed the problem: I want the cross-axis value of a scrollable! On a PageView that'd be the dy (when in default Axis.horizontal) ...
l-k22 commentedon Nov 5, 2019
Has anybody been able to make progress on this? I want to make an EPG (electronic/television programme guide) style layout but there doesn't seem to be anything out there that do it.
justinmc commentedon Nov 5, 2019
Yes actually, this is in progress and coming soon! Here's the WIP PR: #44015
I've mainly been thinking of that widget being used for photo viewers, etc. I'm not sure how well it will cover this use case, but if you think it will, let me know if there's anything I can do to accommodate.
muirandy commentedon Jan 2, 2020
That's great news @justinmc - I've been hoping for something like this for some time (see 23457).
My use case is similar to @l-k22 's: I need to put lots of custom sized boxes on the display, and be able to scroll about and zoom. The number and sizes of boxes will be dynamic.
I see your PR is nearly there, so I'll wait for it and give it a try out. :)
Timmmm commentedon Jan 8, 2020
I'd like something similar for
ListView. I have a list of items, but they can overflow the width so I want the list to be horizontally scrollable too. I did try wrapping the entire list in a horizontalScrollViewbut it gave me errors about unbounded sizes. Maybe it works with a few more widgets but I feel like you should just be able to tellListViewto make the cross-axis scrollable.justinmc commentedon Jan 13, 2020
@muirandy I'm glad this will be useful! I'm interested to see how the dynamic size of the boxes will work with this. Let me know once it's merged and you try it out.
justinmc commentedon Jan 13, 2020
@Timmmm Currently ListView can't scroll both axes. This seems like something that should be doable with InteractiveViewer though. I'll try to specifically try it out. See this table example I made:
Timmmm commentedon Jan 17, 2020
@justinmc That looks interesting, thanks! Do you have a link to this "InteractiveViewer"? Google doesn't seem to know about it.
justinmc commentedon Jan 17, 2020
It's still a work in progress, but hopefully I'll finish it soon: #44015
yasinarik commentedon Jan 18, 2020
I need such a widget especially for using in Flutter Web. #49109 You can check this issue.
It must have a smooth scrolling for both directions. Also, a bool property for locking the scroll direction after the scroll direction detected. (If it is horizontal, lock it to be scrolled only horizontally, else to be scrolled only vertically. This should be optional. Of course, the default behavior must be both directions. )
Cells should be rendered on-demand as ListView.builder does. Otherwise, there will be a huge performance loss.
@justinmc Great news to hear! I really appreciate your work and am very thankful.
EDIT: By the way, there is already a package related to this. However, it lacks the features I request.
https://pub.dev/packages/diagonal_scrollview
justinmc commentedon Jan 21, 2020
@yasinarik Thanks for letting me know you need this, I was hoping to get some feedback like this. I think your first bullet point should be fairly straightforward. I'll try to include it in my PR.
The second bullet point will be a bit trickier, but I imagine it should be doable just like ListView.builder... I won't be able to include it in the initial PR, but I think it's something we that would make sense to add afterwards.
yasinarik commentedon Jan 22, 2020
@justinmc Great news!
justinmc commentedon Jun 3, 2020
The InteractiveViewer widget should now handle this, but it still has some missing features:
marcosagni98 commentedon May 4, 2021
@justinmc is there anyway in which in the computer i could say that the scroll wheel is for scrolling and then to zoom I have to press control + scroll wheel?
justinmc commentedon Jun 23, 2021
@marcosagni98 Unfortunately you'll have to hack your own InteractiveViewer to achieve that right now. At this line the pointer scroll is hard coded to do a scale.
We should make it possible to customize that though... I'm not sure how we could cleanly do that.
github-actions commentedon Jul 31, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.