I have a container that I am trying to print out items form a list, minus the last item in the list. I am using list.generate:
child: Container(
width: double.infinity,
color: Colors.white,
child: ListView(
padding: const EdgeInsets.only(top: 10.0),
children: List.generate(
Provider.of<WeekList>(context).listOfWeeks.toList().length -
1,
(index) => ListTileCustom(
index: index,
),
),
),
),
My problem is when it prints out my custom ListTileCustom
widget each new item added to the list is added to the bottom and not the top in the view.
In the picture above the order should be:
- Red Bar
- Red / Green Bar
- Green bar
and when I add new items by pressing the button they should be added to the top not the bottom.
I tried adding reverse: true
and that gets the order right but moves everything to the bottom and adds a ton of white space above them... Also not sure the scroll will work in the right direction at that point either.