In a column or any widget, when i am trying to use listview.builder it don't execute the code. But when i bundle listview.builder in expanded widget it successfully run. Why it runs in expanded widget not another widget?
in the 1st image Without expand and using shrinkwrap: true my output is like that, but why?
In the 2nd image when I am wrapping my listview.builder in expanded widget it runs successfully, why?
Listview.builder works in Column when you add shrinkwrap property as true. It is because listview and its parent takes different height or size, once you add shrinkwrap property it will get minimized to children height and will work fine. Without shrinkwrap it throw overflow or rendering error.
And when you use it with expanded widget both parent and listview expands to the same height so it working fine with Expanded widget
Related
When i am wrapping scafflod with SingleChildScrollView this error is occured, anyone can give ma a solution for this
Make Scaffold parent widget and inside scaffold body use SingleChildScrollView
Structure
Scaffold -> body:SingleChildScrollView -> child: Other widgets
Scaffold comes over SingleChildScrollView
I'm using the "drag_and_drop_lists" plugin to move around ListTile items in a column in a Flutter app (latest version of Flutter) on Android. My problem: ListTile items with a long subtitle value get clipped in height. In the example below, there's text in a line below after "key from & drop off" that I can't see:
The widget on this screen is a DragAndDropLists. "1", "2", and "3" are the DragAndDropList in it.
Here's what the ListTile looks like - it has a height of 184 pixels:
The plugin wraps my ListTile in a number of widgets. The last one with a height of 184 pixels is the column:
That Column is in a SingleChildScrollView. And that's the first one with the wrong height — 145 pixels:
Here's the line in the source code creating that SingleChildScrollView. If I remove the physics: NeverScrollableScrollPhysics() attribute there, I can scroll my ListTile. Here, the title is now missing, but the whole subtitle is then visible:
I don't know how to get the SingleChildScrollView to show my Column at full height. I tried a number of things but nothing worked. I didn't file a GitHub issue with the plugin, as the plugin author hasn't responded to an issue for quite a while.
I couldn't fix this with a regular ListTile. So instead, I now show a separate Text widget with the text. And that doesn't get clipped.
I have been working on a project for quite a long time now and this error is stopping me
You can try wrapping it with the Expanded widget of the RenderCustomMultiChildLayoutBox widget or giving the height and width value using the SizedBox Widget
I have a Row with some Containers in it, this causes an overflowed on the right.
How can I make that once a container has overflowed, the next ones go in a new line
I hope I was clear and that someone can answer me.
Thank you :)
Instead of using a Row() widget you need to use a Wrap() widget and make sure to have your Container()'s width not overflowed.
Wrap() widget just do according to what you need right now, it arranges its children in horizontal direction(by default - you can change it though) and if any child overflowed then move that child in new line.
How can I use condition in widget? I did it with empty widget like container() or Text() but when I put empty Widget in row() and give spaceBetween of MainAxisAlignment it takes their own space without any showing. Searching on the internet I think there are only the old info so that's not working anymore (if I am wrong I'm really sorry).
If conditions are not allowed and I do not want to show the widget - How can i do that?
If i understand correctly, you want to render Row conditional with size of childrens.
List<Widget> elements = []
Row(children: elements)
First option is to initiate elements inside your initState(){} method.
Another one, if you want to change it dynamically, then you have to know about setState(){} method and how key works, that is optional attribute of all Stateful/Stateless Widgets.