Code Hunter
Code Hunter

Reputation: 11218

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.

Upvotes: 0

Views: 1695

Answers (1)

LarssonK
LarssonK

Reputation: 3053

    //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.

Upvotes: 1

Related Questions