set text button style flutter code example
Example 1: TextButton Style in flutter
TextButton( child: Text('Woolha.com'), style: TextButton.styleFrom( primary: Colors.teal, ), onPressed: () { print('Pressed'); }, )
Example 2: flutter button style
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Theme.of(context).colorScheme.primary.withOpacity(0.5);
return null; // Use the component's default.
},
),
),
)