1

I'd like to create the layout shown in the picture below. This shows up fine:

Column( Row, ListView()))

While this renders errors:

Column( Row, Row( ListView(), Column ))

As soon as I replace the inner ListView() with Row( ListView(), Column ), nothing shows up and I get varying error messages, based on various changes I did.

Most often, I see a 'viewport has unlimited horizontal size'.

I guess Listview to be the source of the problem. That said, I'm no aware how to fix it.

Furthermore, I did find various hints on SO, but none fixed the problem.

How do I fix the problem?

Update 1

While the right Column() may be fixed width, the ListView() should take all remaining space of the screen [= availableWidth - WidhtOf(Column())].

enter image description here

2 Answers 2

1

put the ListView inside a Container And give it height/width

code

Column(
    children: [
      Row(
        children: [],
      ),
      Row(
        children: [
          Container(
              height: 100,
              width: 100,
              child: ListView(
                children: [
                  Text(
                      "1 C/G")
                ],
              )),
          Column(
            children: [],
          )
        ],
      )
    ],
  ),
Sign up to request clarification or add additional context in comments.

3 Comments

Indeed, this solution renders. Unfortunately, I want the inner ListView to take all available space. The right column (a property inspector) may be fixed width, while the ListView should 'grab' all the remaining width. Any hints?
so if you know the size of the right column you can set the Column width with container and set the width " MediaQuery.of(context).size.height * 0.2" and for the listview you can set the container width as "MediaQuery.of(context).size.height * 0.8" this should take all the place on the screen NOTE: if you have a ui like first row have a width , this method above will not work but it should work if you set every thing with MediaQuery i Recommend you to take a look at (MediaQuery) its responsive ui
Thank you! I'll do. Currently I'm a Flutter newbie ;-)
0

Both Row and Column have a mainAxisSizeparameter where you can set it to MainAxisSize.min so they will take their children's size. Now, about the ListView, there is a shrinkWrap parameter that makes it so its max size will be its children's size. Another idea might be using a Flexible widget around the ListView, it does almost the same as Expanded, but the difference is: Expanded forces the child to occupy the remaining space, while Flexible allows the children to have any given size smaller than that, and that's because of its fit parameter that by default is FlexFit.loose.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.