xxxxxxxxxx
import 'package:flutter/material.dart';
class MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 2, // Adjust the elevation value as per your requirement
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), // Adjust the border radius as per your requirement
),
// Add other properties like padding, background color, etc., as needed
),
onPressed: () {
// Add your button press logic here
},
child: Text('Button'),
);
}
}
xxxxxxxxxx
ElevatedButton(
child: Text('Button'),
onPressed: () {},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.red),
padding: MaterialStateProperty.all(EdgeInsets.all(50)),
textStyle: MaterialStateProperty.all(TextStyle(fontSize: 30))),
),
xxxxxxxxxx
ElevatedButton(
style: ElevatedButton.styleFrom(
onPrimary: Colors.black87,
primary: Colors.grey[300],
minimumSize: Size(88, 36),
padding: EdgeInsets.symmetric(horizontal: 16),
shape: ElevatedButton.styleFrom(
primary: ThemeColors.darkBg,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.black)),
),
onPressed: () { },
child: Text('Looks like a RaisedButton'),
)
xxxxxxxxxx
ElevatedButton(
child: Text('Button'),
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.purple,
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
textStyle: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold)),
),
xxxxxxxxxx
ElevatedButton(
style: ElevatedButton.styleFrom(
// Add your desired styling properties here
primary: Colors.blue, // Sets the button background color
onPrimary: Colors.white, // Sets the button text color
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), // Sets the button's border radius
),
),
onPressed: () {
// Add your button logic here
},
child: Text('My Elevated Button'),
)
xxxxxxxxxx
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Colors.green;
return null; // Use the component's default.
},
),
),
)
xxxxxxxxxx
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue, // Change this line to set the desired color
),
onPressed: () {
// Add button logic here
},
child: Text('Button'),
)