skip to Main Content

There is a row with 3 expanded containers; the mid-container has a fixed height.

The goal is to make the height of the containers in both ends implicitly match the height of the mid-container.

A visual structure would look as follows:

Scaffold:
  Row:
    Expanded:
      Container(height: ?)
    Expanded:
      Container(height: 100)
    Expanded:
      Cotnainer(height: ?)

2

Answers


  1. You can use IntrinsicHeight(little expensive)

     IntrinsicHeight(
        child: Row(....),
     ),
    
    Login or Signup to reply.
  2. Remove height from side containers. Set:

    Row(
       crossAxisAlignment: CrossAxisAlignment.stretch,
       ...
    

    This will stretch all containers to fit the tallest.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search