I have a Column of items like this:
Column(
children: [
...items,
Spacer(),
Footer(),
],
)
However, the items
list may be dynamic, which makes necessary use a ListView
instead of Column
. The only problem is that my Footer
was separated with anSpacer
, the Spacer
widget will throw error if its used in a ListView.
What can I use to give the effect of a Column
to my ListView
when are just a few items that not filled all the screen?
3
Answers
I found this solution:
You can use SizeBox(heigth:your hieght) instead of Spacer();
This is the issue I had a lot when I was still learning.
I think you have a same issue,
Step 1: You shouldn’t use
SingleChildScrollView
as a parent of thatColumn
.Step 2: Use
Expanded
Widget inside theColumn
.Step 3: Inside the
Expanded
use anotherColumn
and put thoseitems
.For example:
You can have the scroll behaviour for that 2nd
Column
by givingSingleChildScrollView
or use anyListView