flutter text button 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.
      },
    ),
  ),
)

Tags:

Misc Example