对齐元素独立于颤动的行/列

问题描述 投票:0回答:1

我是新手,在最近的广泛编码中,我遇到了一种情况,即我必须不合理地对齐行中的元素。我有3个子元素,分别称为A,B和C。我的要求是到该行最左端的A和B,到最右端的元素C。

期望:

enter image description here

我的代码:

Row(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              CircleAvatar(
                backgroundImage: NetworkImage(''),
                radius: 30,
              ),
              SizedBox(
                width: 10,
              ),
              Flexible(
                child: Text('name', overflow: TextOverflow.ellipsis,),
              ),
              SizedBox(
                width: 10,
              ),
              Container(
                child: ButtonTheme(
                  height: 25.0,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(100.0)),
                  child: RaisedButton(
                    child: Text(
                      'Challenge',
                      style: TextStyle(color: Colors.white, fontSize: 12),
                    ),
                    onPressed: () {},
                  ),
                ),
              ),
            ],
          ),

但是输出是这样的:enter image description here

[当我尝试使用Spacer()时,输出如下:enter image description here

任何人都可以帮助我。预先感谢。

我是新手,在最近的广泛编码中,我遇到了一种情况,即我必须不合理地对齐行中的元素。我有3个子元素,可以分别命名为A,B和C。我的要求是...

flutter flutter-layout
1个回答
0
投票

尝试一下,效果很好,检查下面的代码:

© www.soinside.com 2019 - 2024. All rights reserved.