xxxxxxxxxx
ElevatedButton(
style: ButtonStyle(
fixedSize: MaterialStateProperty.all<Size>(
Size(double.infinity, desiredHeight),
),
),
onPressed: () {
// handle button press
},
child: Text('Button'),
)
xxxxxxxxxx
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
),
onPressed: () {},
child: Text('ElevatedButton')),
xxxxxxxxxx
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(150, 48), // takes postional arguments as width and height
),
),
OR
// Wrap the ElevatedButton inside a SizedBox or a Container and set your with and height
xxxxxxxxxx
SizedBox(
width: 200, // Replace with your desired width
child: ElevatedButton(
onPressed: () {
// Add the button's onPressed event handler
print('Button pressed!');
},
child: Text('My Button'),
),
)
xxxxxxxxxx
SizedBox(
height: 50, // specify the desired height here
child: ElevatedButton(
onPressed: () {
// button logic goes here
},
child: Text('Button'),
),
)