Right now I am using a column to display several widgets:
Column(
children: [
Text('1'),
Text('2'),
Spacer(),
Text('3'),
Text('4'),
],
),
So the screen looks like this:
---
1
2
3
4
---
It allows me to always align '1'
and '2'
at the top and '3'
and '4'
at the bottom of my widget independently of its size.
However, when the widget becomes too small, it overflows:
---
1
2
3
---
4 // <- Overflow
Because of this, I would like to achieve the same result with a ListView
so:
- When the widget is high enough,
'1'
'2'
are top-aligned and'3'
'4'
are bottom-aligned. - When the widget is not high enough, there is no extra space anymore between
'2'
and'3'
, but the user can scroll down.
I couldn't manage to use a Spacer
a ListView
. It throws me the error:
Failed assertion: line 1940 pos 12: 'hasSize'
What would be the correct way to implement it?