-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Unexpected top padding in ListView put inside scaffold with no appBar #14842
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
Comments
/cc @HansMuller @Hixie |
Just had this problem, top
|
Yeah this is intentional. If you put a widget before the |
Well, as long as this is documented I will close the issue |
I'm not sure it's well-documented yet. If you can't find it in the documentation, please don't hesitate to reopen. |
I had this same issue and after some search this is the only exact answer I've found. Maybe is worth to create a short entry on documentation about window measurement and specific cases |
Found this topic because I thought this is maybe a bug or I did oversee something. So maybe some more info is needed. (I would prefer a method to turn this off inside the listview, too. This would be easier.) |
I did not find it in the documentation, is it there? |
I assume this should not be closed because @Hixie added the |
https://api.flutter.dev/flutter/widgets/ListView-class.html The docs now have a comment about this behavior:
I think it can be closed. |
This solution is amazing. Thank you so much. |
Thank you very much!
|
I do not feel the documentation is helpful. I would be lost without an example line of code. |
We can also fix this by wrapping whole Scaffold body part in SafeArea if there is no Appbar in your screen.
|
The solution that worked for me was to set the ListView padding to zero as here
Most likely this is not the most recommended way, but since I can define the size of the ListView through its parent that is a Container, and the Card() widget has its own defined size. One of most likely many solutions for this problem. Felt like sharing it as none of the options above suited my situation. |
Tks a lot! This applies too when we need to show one scaffold into another scaffold |
thanks, this work for me |
This was really an unexpected implicit and hidden that made you doubt your own sanity (until adding @Hixie (the guy who thought me CSS box model on Freenode IRC about 18-20yrs ago <3) : |
Once you know about SafeArea it makes more sense. The problem is that in trying to make SafeArea work automatically without having to think about it, we also require that in cases where you do things it can't handle you have to handle it. I don't think we have a good solution to this other than improving the docs. If this is still confusing then we should add another section to the "troubleshooting" part of the Scaffold docs. Please do file a new bug if you'd like us to do that. |
Well that was a life saver, thanks. |
This solution helped me and removed my top space of GridView.builder widget:
Happy to get your help. Thanks dear. |
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 |
If you put
ListView
somewhere insideScaffold
having noappBar
,ListView
has top padding. There is no padding ifappBar
is present. There is no padding if you specifyEdgeInsets.zero
padding forListView
explicitly. See following code snipped for exampleSee screenshot:
Flutter Doctor:
The text was updated successfully, but these errors were encountered: