I have added a border to my TextButton.
TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0)))),
onPressed: () {
replacePoints();
},
child: Text(
"${AppLocalizations.of(context)!.replacePoints} +",
style: TextStyle(color: Colors.white),
))
How can I change its colour (only outline colour not background)?
Try this:
TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(
side: BorderSide(
color: Colors.red, // your color here
width: 1,
),
borderRadius: BorderRadius.circular(0)))),
onPressed: () {
replacePoints();
},
child: Text(
"${AppLocalizations.of(context)!.replacePoints} +",
style: TextStyle(color: Colors.white),
))
Try below code you will change Border color in two ways
Using TextButton.styleFrom refer styleFrom
TextButton(
style: TextButton.styleFrom(
side: BorderSide(
color: Colors.green,
),
),
onPressed: () {
//write your onPressed function here
print('Button Press');
},
child: Text(
'Hello, World!',
style: Theme.of(context).textTheme.headline4,
),
),
Result-> 
Using ButtonStyle Class refer ButtonStyle
TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
side: BorderSide(
color: Colors.blue,
),
borderRadius: BorderRadius.circular(5),
),
),
),
onPressed: () {
//write your onPressed function here
print('Button Press');
},
child: Text(
'Hello, World!',
style: Theme.of(context).textTheme.headline4,
),
),
Result-> 
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