In flutter
version 3.3.0
ElevatedButton
onSurface
is deprecated i am confused which property should i use instead onSurface
. should i use disabledForegroundColor
or disabledBackgroundColor
or Both?
CodePudding user response:
If you need to change both text and button color for disabled state, you should use both disabledForegroundColor
and disabledBackgroundColor
.
But
using normally only the disabledBackgroundColor
should be enough for the button.
CodePudding user response:
Use foregroundColor
and disabledForegroundColor
instead of onSurface
.
style: ElevatedButton.styleFrom(
foregroundColor:Colors.red,
disabledForegroundColor:Colors.green,