This example creates a button that overrides its foreground color, as
well as its overlay color, using the specified primary color and the
opacities from the Material Design spec.

TextButton

style:

TextButton

styleFrom

primary:

Colors

blue

),

onPressed:

()

},

child:

Text

'TextButton'

),

The TextButton documentation indicates that the foreground color when
the button is disabled is based on the color scheme’s onSurface
color. To override that as well, using styleFrom():

TextButton

style:

TextButton

styleFrom

primary:

Colors

blue

onSurface:

Colors