简体   繁体   English

颤振中的弯曲半径按钮

[英]Curved radius button in flutter

I am trying to create a curved button in flutter. 我试图在颤动中创建一个弯曲的按钮。 But for me borderRadius tag is not working. 但是对我而言,borderRadius标签不起作用。 Here is my code 这是我的代码

    //Login Button
    final loginButton = Padding(
      padding: EdgeInsets.symmetric(vertical: 16.0),
      child: Material(
        borderRadius: BorderRadius.circular(30.0),
        shadowColor: Colors.lightBlueAccent.shade100,
        elevation: 5.0,
        child: MaterialButton(
          minWidth: 200.0,
          height: 42.0,
          onPressed: () {
//            Navigator.of(context).pushNamed(HomePage.tag);
          },
          color: Colors.lightBlueAccent,
          child: Text('Log In', style: TextStyle(color: Colors.white)),
        ),
      ),
    );

I am not getting where I did mistake in this. 我不会在这方面犯错。

    //Login Button
    final loginButton = Padding(
      padding: EdgeInsets.symmetric(vertical: 16.0),
      child: Material(
        borderRadius: BorderRadius.circular(30.0),
        shadowColor: Colors.lightBlueAccent.shade100,
        elevation: 5.0,
        Colors.lightBlueAccent,
        child: MaterialButton(
          minWidth: 200.0,
          height: 42.0,
          onPressed: () {
//            Navigator.of(context).pushNamed(HomePage.tag);
          },

          child: Text('Log In', style: TextStyle(color: Colors.white)),
        ),
      ),
    );

Try the above code I moved the colour tag up out of the MaterialButton into the Material widget. 尝试上面的代码,我将颜色标签从MaterialButton上移到了Material小部件中。 I've tested it and it works as it should in Flutter dev v0.7.1. 我已经对其进行了测试,并且可以在Flutter dev v0.7.1中正常运行。 I can't help any more unless you explain what you mean by what it not working and how you expect it to work. 除非您解释一下它不起作用以及期望它如何工作的意思,否则我将无济于事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM