Flutter align two items on extremes - one on the left and one on the right

前端 未结 4 947
半阙折子戏
半阙折子戏 2020-12-24 04:20

I am trying to align two items at extremes one on the left and one on the right. I have one row that is aligned to the left and then a child of that row is aligned to the ri

4条回答
  •  轮回少年
    2020-12-24 04:49

    Use a single Row instead, with mainAxisAlignment: MainAxisAlignment.spaceBetween.

    new Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        new Text("left"),
        new Text("right")
      ]
    );
    

    Or you can use Expanded

    new Row(
      children: [
        new Text("left"),
        new Expanded(
          child: settingsRow,
        ),
      ],
    );
    

提交回复
热议问题