text button flutter style code example
Example 1: text button flutter style
TextButton(
child: Text('Text'),
style: TextButton.styleFrom(primary: Colors.blue),
onPressed: () {
print('Pressed');
},
)
Example 2: TextButton Style in flutter
TextButton( child: Text('Woolha.com'), style: TextButton.styleFrom( primary: Colors.teal, ), onPressed: () { print('Pressed'); }, )
Example 3: 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.
},
),
),
)
Example 4: text button flutter
TextButton.icon({
Key key,
@required VoidCallback onPressed,
VoidCallback onLongPress,
ButtonStyle style,
FocusNode focusNode,
bool autofocus,
Clip clipBehavior,
@required Widget icon,
@required Widget label
})
// Example:
TextButton.icon(
icon: Icon(Icons.camera),
label: Text('Take A Photo'),
onPressed: () {},
)