Flutter,如何将UI放在按钮上?

问题描述 投票:0回答:2
  Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 80.0),
                      child: RaisedButton(
                        onPressed:() {
                          Navigator.push(context, MaterialPageRoute(builder: (context) => SecondPage()),
                          );
                        },
                      child: Container(
                        margin: EdgeInsets.symmetric(vertical: 0),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(50),
                          color: Color.fromRGBO(49, 39, 79, 1),
                        ),
                        child: Center(
                          child: Text(
                            "Login", style: TextStyle(color: Colors.white),),
                        )
                    )
                      ))]),

您可以从代码中看到,UI登录容器位于按钮的前面,但是尺寸非常小。无论如何,我可以将所有这些捆绑在一起吗?

user-interface button flutter uibutton
2个回答
0
投票

这是您要寻找的吗?

Padding(
      padding: const EdgeInsets.symmetric(horizontal: 80.0),
      child: RaisedButton(
        color: Color.fromRGBO(49, 39, 79, 1),
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(50)),
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => Scaffold()),
          );
        },
        child: Center(
          child: Text(
            "Login",
            style: TextStyle(color: Colors.white),
          ),
        )
      )
    )

0
投票

您在寻找这个吗?

image here

FlatButton(
      child: Container(
        height: 80.0,
        child: Center(
          child: Text(
            "Login",
            style: TextStyle(color: Colors.white),
          ),
        ),
        padding: const EdgeInsets.symmetric(horizontal: 80.0),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(50),
          color: Color.fromRGBO(49, 39, 79, 1),
        ),
      ),
      onPressed: () {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => SecondPage()),
        );
      },
    ),
© www.soinside.com 2019 - 2024. All rights reserved.