与父母的卡片宽度匹配:颤抖

问题描述 投票:2回答:2

我是Flutter的新手,所以我想知道如何设置宽度以匹配父版面宽度

new Scaffold(
    body: new Container(
  decoration: new BoxDecoration(color: AppColors.hoBlue),
  child: Padding(
    padding: EdgeInsets.all(20.0),
    child: new Center(
        child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Stack(
          children: <Widget>[
            Row(
              children: <Widget>[
                Expanded(
                  child: Padding(
                    padding: EdgeInsets.all(20.0),
                    child: Card(
                      child: Padding(
                          padding: EdgeInsets.fromLTRB(20, 0.0, 20.0,20.0),
                          child: Column(
                            children: <Widget>[
                               Card(
                                    elevation: 10.0,
                                    child: Padding(
                                      padding: EdgeInsets.all(20.0),
                                      child:
                                      Text("Sign Up Here"),
                                    ),
                                  ),
                              TextField(
                                decoration: InputDecoration(
                                  labelText: "Email",
                                  hintText: "[email protected]",
                                ),
                                autofocus: true,
                              ),
                              TextField(
                                decoration: InputDecoration(
                                  labelText: "Password",
                                ),
                                autofocus: true,
                              ),
                              SizedBox(
                                width: double.infinity,
                                // height: double.infinity,
                                child: new RaisedButton(
                                  color: AppColors.hoBlue,
                                  child: Text(
                                    "Sign In",
                                    style: TextStyle(
                                      color: Colors.white,
                                      fontFamily: 'Raleway',
                                      fontSize: 22.0,
                                    ),
                                  ),
                                  onPressed: () => print('Sign In'),
                                ),
                              )
                            ],
                          )),
                    ),
                  ),
                ),
              ],
            )
          ],
        ),
      ],
    )),
  ),
));

Result From Code Above

我需要帮助来与父母一起制作纸牌Result I want

我已经尝试过使用堆栈,但是结果卡的父卡与第一张卡重叠。

我对Expanded标签了解得很少,但是向两个方向扩展Expanded视图,我都不知道该怎么做。如果您知道的话,请帮助我,谢谢。

dart flutter flutter-layout
2个回答
1
投票

您不需要Stack即可获取该视图-可以使用ColumnMaterial小部件来完成。


0
投票

如果要调整大小或更改卡片视图,则只需将卡片

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