I got errors when updating my flutter version to 3.3.8. All of textbutton class has these errors. Actually, I just need to use elevatedButton but Im curious what is the correct syntax if we want to use textbutton?
2
The style inside your style: TextButton.styleform needed a ButtonStyle as a type. you can’t put a TextButton widget insedo of Textbutton too
style: TextButton.styleform
ButtonStyle
this is a simple TextButton that you can refer
TextButton( child: Text('Text'), style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)), onPressed: () { // action on pressed }, ),
Try below code:
TextButton( onPressed: () =>handleSignUp(), style: TextButton.styleFrom( backgroundColor: Colors.green, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: const Text('DAFTAR'), ),
Click here to cancel reply.
2
Answers
The style inside your
style: TextButton.styleform
needed aButtonStyle
as a type. you can’t put a TextButton widget insedo of Textbutton toothis is a simple TextButton that you can refer
Try below code: