FLUTTER | Right Align not working

前端 未结 3 616
梦谈多话
梦谈多话 2021-02-18 16:54

Trying to right align a container with text view child, it has a row parent which is inside another column, tried number of solutions from Stack Overflow, didn\'t work.

相关标签:
3条回答
  • 2021-02-18 17:41

    Screenshot:


    You can also try Wrap like this:

    Wrap(
      spacing: 50, // spacing between each of the widgets below
      children: <Widget>[
        Text("One"),
        Text("Two"),
        Text("Three"),
      ],
    )
    
    0 讨论(0)
  • 2021-02-18 17:54

    Use Spacer which will get remaining space and will divide the widget equally

         Row(
            children: <Widget>[
              Text("Text 1", style: TextStyle(fontSize: 20),),
              Spacer(),
              Text("Text 2", style: TextStyle(fontSize: 20),),
              Spacer(),
              Text("Text 3", style: TextStyle(fontSize: 20),),
            ],
          ),
    

    Output:

    0 讨论(0)
  • 2021-02-18 17:54

    Use the mainAxisAlignment property in Row widget.

    new Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween, 
        ...
    )
    
    0 讨论(0)
提交回复
热议问题