Make container widget fill parent vertically

前端 未结 6 983
天命终不由人
天命终不由人 2020-12-25 09:38

TL;DR Need the container to fill the vertical space so that it can act as a ontap listener. Have tried most solutions but nothing seems to work.

So what I am trying

6条回答
  •  情书的邮戳
    2020-12-25 10:22

    To stretch the container to full height of the parent use property constraints:BoxConstraints.expand() in container widget. Container occupy the complete space independent of the of child widget

    Container(
      color: Colors.green,
      child: Text("Flutter"),
      constraints: BoxConstraints.expand(),
    )
    

    Please refer the link Container Cheat sheet for more about container

提交回复
热议问题