I used RaisedButton
this way:
RaisedButton(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24.0)),
onPressed: null,
padding: EdgeInsets.all(12.0),
color: Colors.blue,
child: Text("Button", style: TextStyle(color: Colors.white)))
They decided to make RaisedButton
deprecated and ElevatedButton
should be used instead. However, padding
and shape
properties are missing. How to get the same effect with ElevatedButton
?
CodePudding user response:
You can use the style property in the Elevated Button, and then you can use "ElevatedButton.styleFrom" class and in their you will find the properties like padding and shape:
Here is an Example:
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue,
elevation: 5,
padding: EdgeInsets.all(12.0),
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),),),
onPressed: handler,
child: Text("Button", style: TextStyle(color: Colors.white)))
),
CodePudding user response:
Try this code hope its help to you its similar to RaisedButton
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
fixedSize: Size(90, 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(24.0),
),
),
),
child: Text("ok"),
),