Home > Back-end >  Try correcting to the name of an existing method, or defining a method named 'OutlineButton
Try correcting to the name of an existing method, or defining a method named 'OutlineButton

Time:05-12

i have installed flutter 3.0.0 . now i am getting error that outlinedbutton isn't defined for the type. Error: Method not found: 'OutlineButton'. lib/appUtils/app_utility.dart:233

                            OutlineButton(
                            ^^^^^^^^^^^^^

: Error: Method not found: 'OutlineButton'. lib/appUtils/app_utility.dart:255 OutlineButton(

                            ^^^^^^^^^^^^^

CodePudding user response:

That widget have been changed to OutlinedButton.

Old Widget was : OutlineButton
Old Theme was : ButtonTheme
New Widget is : OutlinedButton
New Theme is : OutlinedButtonTheme

Here's an example :

OutlinedButton(
    style: OutlinedButton.styleFrom(
        shape: StadiumBorder(),
            side: BorderSide(
              width: 2,
              color: Theme.of(context).colorScheme.primary,
            ),
        ),
    onPressed: () { dismissDialog(); },
    child: Text('New Outlined Button'),
),

CodePudding user response:

Yes. That is a breaking change. And it is listed up top in the breaking changes documentation:

The FlatButton, RaisedButton and OutlineButton widgets have been replaced by TextButton, ElevatedButton, and OutlinedButton respectively.

source

  • Related