Just now I upgraded to Flutter 3.3.0
The method 'FlatButton' isn't defined for the type '_PickerFieldState'. (Documentation) Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
CodePudding user response:
FlatButton is deprecated, use TextButton instead. Like this:
TextButton(onPressed: (){}, child: Text('Tap')),
CodePudding user response:
Instead of RaisedButton, we need to use ElevatedButton
To have similar ui we can use this style
final ButtonStyle raisedButtonStyle = ElevatedButton.styleFrom(
onPrimary: Colors.black87,
primary: Colors.grey[300],
minimumSize: Size(88, 36),
padding: EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
),
);
ElevatedButton(
style: raisedButtonStyle,
onPressed: () { },
child: Text('Looks like a RaisedButton'),
)
Ref and find more about restoring the original button visuals