I'm trying set rounded border to my MaterialButton
, to do it I'm setting a RoundedRectangleBorder
to shape attribute's MaterialButton
, the problem is that it's not have effect.
Code:
Widget _showNeedHelpButton() {
return new Padding(
padding: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 0.0),
child: new MaterialButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20.0))),
elevation: 5.0,
minWidth: 200.0,
height: 35,
color: Color(0xFF801E48),
child: new Text('Preciso de ajuda',
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
onPressed: () {
setState(() {
_isNeedHelp = true;
});
},
),
);
}
Result:
If you want border for all the corners you can use like bellow. Container( decoration: BoxDecoration( color: Colors. white, borderRadius: BorderRadius.
In Flutter, the Container() widget is used for styling your widget. Using the Container() widget, you can set a border or rounded corner of any widget. If you want to set any type of styling and set the decoration, put that widget into the Container() widget. That provides many properties to the decoration.
MaterialButton(
child: Text('My Button'),
height: 40,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
)
RoundedRectangleBorder will help you https://api.flutter.dev/flutter/painting/RoundedRectangleBorder-class.html
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