How to add border radius for OutlinedButton and ElevatedButton with background color
OutlinedButton
ElevatedButton
2
try below example :
in ElevatedButton Example :
ElevatedButton( onPressed: () { // Add your button click logic here }, style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), side: BorderSide( width: 2, color: Colors.green), ), backgroundColor: Colors.red, ), child: Text('My Button'), ),
In OutlineButton Example :
OutlinedButton( onPressed: () { }, style: OutlinedButton.styleFrom( backgroundColor: Colors.white, side: BorderSide( width: 2, color: Colors.blue, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), // Adjust the radius as needed ), ), child: Text('My Button'), ),
Try below code I have write code on your provided images, some reference URL below
OutlinedButton, ElevatedButton, Style Class
Column( mainAxisAlignment: MainAxisAlignment.center, children: [ OutlinedButton( onPressed: () {}, style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), side: const BorderSide(width: 1, color: Colors.green), fixedSize: const Size(200, 50), //Add width and height on your need ), child: const Text( 'Clear', style: TextStyle(color: Colors.grey), ), ), const SizedBox( height: 10, ), ElevatedButton( onPressed: () {}, style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), side: const BorderSide(width: 1, color: Colors.green), backgroundColor: Colors.green, fixedSize: const Size(200, 50), //Add width and height on your need ), child: const Text('Apply'), ), ], ),
Result Screen->
Click here to cancel reply.
2
Answers
try below example :
in ElevatedButton Example :
In OutlineButton Example :
Try below code I have write code on your provided images, some reference URL below
OutlinedButton, ElevatedButton, Style Class
Result Screen->