Containers with dynamic sizes inside a listview widget

85 Views Asked by At

I'm creating a listview widget and i want it to have varying container sizes that change from user inputs inside it, the problem is when i wrap my columns or rows in expanded widgets, the code breaks. is there a way to set a min and max height for a list view widget?

ListView(
  children: [
    Column(
      children: [
        Row(
          children: [
            Expanded(
              child: Container(
                color: Colors.yellow,
              ),
            ),
            Container(
              width: 2,
              color: kKillTeamOrange,
            ),
            Expanded(
              child: Container(
                color: Colors.green,
              ),
            ),
          ],
        ),
      ],
    ),
  ],
),

I tried wrapping the listview in a constrained container but no luck, the other option would be to have the buttons set the height state but there are a lot of buttons to code that. and using expanded widgets is great for varying screen sizes.

any help would be greatly appreciated. cheers

1

There are 1 best solutions below

0
mc100p On BEST ANSWER

Two ways came to mind:

  1. CustomScrollView
  2. ListView (But using cards) Both ways are responsive to screen sizes

LISTVIEW WITH CARD:

enter image description here

CUSTOM SCROLLVIEW:

enter image description here

RESULT:

enter image description here enter image description here

hope this helps...