简体   繁体   中英

Curved radius button in flutter

I am trying to create a curved button in flutter. But for me borderRadius tag is not working. 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. I've tested it and it works as it should in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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