flutter row 横向平分为2个Container设置为正方形

 

Row(
  children: [
    Expanded(
      child: AspectRatio(
        aspectRatio: 1,
        child: Container(
          color: Colors.blue,
          child: Center(
            child: Text('Container 1'),
          ),
        ),
      ),
    ),
    Expanded(
      child: AspectRatio(
        aspectRatio: 1,
        child: Container(
          color: Colors.green,
          child: Center(
            child: Text('Container 2'),
          ),
        ),
      ),
    ),
  ],
)

 

posted @ 2023-09-23 17:53  小小强学习网  阅读(139)  评论(0编辑  收藏  举报