I am using flutter version 3.0.0
I am having a TextButton, but I get an error on the foregroundColor property showing, The named parameter 'foregroundColor' isn't defined.
I also tried uisng flutter 3.3.3, but still get the same error.
TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: Theme.of(context).colorScheme.secondary,
),
)
CodePudding user response:
Use the MaterialStateProperty in the Flutter 3 versions
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(Colors.whtie,),
),
),
See also https://docs.flutter.dev/release/breaking-changes/buttons