I am not able to any sample for creating a circular button like FloatingActionButton? Is there any way to create it?
Below code creates a rectangular button, is there any for Circular Button?
shape: RoundedRectangleBorder(borderRadius: new BorderRadius.circular(30.0))
You can use the MaterialButton widget.
It's shape field can be set to CircleBorder value and that will give you a circular button.
For example, I've modified the code of one of my projects views where I have rounded rectangle buttons to make one of them circular:
Container(
width: 80,
height: 80,
child: MaterialButton(
shape: CircleBorder(
side: BorderSide(
width: 2,
color: Colors.red,
style: BorderStyle.solid,
),
),
child: Text("Login"),
color: Colors.teal,
textColor: Colors.amber,
onPressed: (){},
),
),
Screenshot:
Container( width: 90, height: 90, child: RaisedButton(onPressed: (){ }, color: Colors.deepOrange, textColor: Colors.white, shape: CircleBorder(side: BorderSide.none), child: Text('Login',style: TextStyle( fontSize: 20.0 ), ), ), )
We can create a circular button by FloatingActionButton
widget.
return Container(
alignment: Alignment.center,
child: new SizedBox(
child: FloatingActionButton(
backgroundColor: Colors.red,
child: null,
onPressed: () {
print("Cliked");
},)
));
}
Output:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With