skip to Main Content

I have roughly the following code

Column(
  getWidget1(),
  getWidget2(),
  // Expanded(
    SingleChildScrollView(
      child: Table(
        children = manyRows()
      )
   // )
  )
)

I’m aware that using columns and scrollable is problematic, either throwing constraint errors (due to column providing virtually infinite vertical space, and expanded trying to take all the remaining space or SingleChildScrollViews trying to fit all their content or expanded, which results in an overflow)

How to fit a scrollable inside a column, that take all the space left? currently I’m implementing a workaround using SizedBox with hardcoded height, but it’s not sufficient.

3

Answers


  1. you need to set the height for
    getWidget1() and getWidget2()

    Column(
      Container(height: 100, child: getWidget1()),
      Container(height: 100, child: getWidget2()),
      Expanded(
        SingleChildScrollView(
          child: Table(
            children = manyRows()
          )
       )
      )
    )
    
    Login or Signup to reply.
  2. You need to wrap column with IntrinsicHeight.

    Login or Signup to reply.
  3. Try this way,By wrapping the SingleChildScrollView with Expanded.

      Column(
          children: [
            getWidget1(),
            getWidget2(),
            Expanded(
              child: SingleChildScrollView(
                child: Table(
                  children: manyRows(),
                ),
              ),
            ),
          ],
        );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search