颤振|右对齐不起作用 [英] FLUTTER | Right Align not working

查看:66
本文介绍了颤振|右对齐不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使容器与文本视图子级右对齐,它的父级行位于另一列内,尝试了Stack Overflow的多种解决方案,但无效.

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.

代码

///Transactions Heading
        new Column(
         children: <Widget>[
            new Row(
              children: <Widget>[
                new Container(
                  alignment: Alignment.centerLeft,
                  margin: new EdgeInsets.only(top: 20.0, left: 10.0),
                  child: new Text(
                    "Transactions",
                    style: new TextStyle(
                      color: primaryTextColor,
                      fontSize: 25.0,
                      fontWeight: FontWeight.w700,
                      letterSpacing: 0.1,
                    ),
                  ),
                ),
                new Container(
                  margin: new EdgeInsets.only(top: 25.0),
                  child: new Text(
                    currentGoalTransactions.length.toString() + " items",
                    style: new TextStyle(
                        color: darkHeadingsTextColor, fontSize: 15.0),
                  ),
                ),
              ],
            ),
       ]);

想要将2个项目的文本向右对齐

屏幕截图

推荐答案

使用 Row 小部件中的 mainAxisAlignment 属性.

Use the mainAxisAlignment property in Row widget.

new Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween, 
    ...
)

这篇关于颤振|右对齐不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆