-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Weird behaviour with PageView #11273
Comments
What is the purpose of the Column in this code? |
How high do you want each PageView to be? |
Ah. The problem is that there's no way for the page views to know how high all its children are, because it only renders one at a time. The others aren't even in memory. So it would have no idea how high to be. |
Well you can put the PageViews inside a SizedBox with a height, if you know how high your page views are going to be. But we don't currently have a way to shrink-wrap a PageView around its children, because we don't know what the children are (which is very intentional, it's to get a performance improvement). |
@Hixie and if we dont know the height? |
To clarify, you want a PageView that is as high as the highest page's content? This is not something we currently support. To do that, you'd have to fully lay out every page (which could potentially themselves be infinitely high, e.g. if a page has an infinite scrolling list). That defeats the whole point of PageView which is to only instantiate what's on the screen. It would be potentially very inefficient to do that. |
I was just trying to achieve the exact same thing as the author. After failing for stubborn 2 hours I found this issue. Is this still considered unwanted because of performance or might this actually be implemented in the future? |
I recommend filing a new issue that describes (without reference to specific widgets) the precise interface you are trying to implement (ideally with diagrams), and then we can see what advice we can give you. :-) |
@Hixie I want the child of the pageview to have a fixed width. Right now I am using viewportFraction and some margin to achieve that in portrait mode but sadly it won't work in landscape as shown in the screenshot below. Potrait Screenshot:Landscape Screenshot: |
OK I calculated the "viewportFraction" of PageController as
This fixed the issue but will there be built in way to give a fixed height and width to the child of pageview? |
same problem |
Same here as well. I get that the height in a horizontal page view can't be calculated, but you should still be able to put a fixed width on each child, right? Is there a way to preserve the children's width and/or lock the aspect ratio? |
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 |
Objective
I just wanted to create a Widget with multiple
PageView
Widgets in aColumn
Widget for users to scroll through.The documentations says:
Why is this?
Steps to Reproduce
Create a "screen" and start that as the homescreen:
Logs
When I remove the
Flexible
Widget it gives me this error:Flutter Doctor
The text was updated successfully, but these errors were encountered: