skip to Main Content

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?

enter image description here

2

Answers


  1. The style inside your style: TextButton.styleform needed a ButtonStyle as a type. you can’t put a TextButton widget insedo of Textbutton too

    this is a simple TextButton that you can refer

    TextButton(
        child: Text('Text'),
        style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)),
        onPressed: () {
             // action on pressed
        },
    ),
    
    Login or Signup to reply.
  2. Try below code:

    TextButton(
              onPressed: () =>handleSignUp(),
              style: TextButton.styleFrom(
                backgroundColor: Colors.green,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(12),
                ),
              ),
              child: const Text('DAFTAR'),
            ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search