Does anybody know how to enable/disable a Flutter ElevatedButton? I've reviewed the documentation but I can't see anything that is obvious.
class IcoButton extends StatelessWidget {
IcoButton(
{@required this.lbl,
@required this.col,
@required this.ico,
@required this.onPress});
final String lbl;
final FaIcon ico;
final MaterialColor col;
final Function onPress;
@override
Widget build(BuildContext context) {
return ElevatedButton.icon(
label: Text(lbl),
icon: ico,
style: ElevatedButton.styleFrom(
primary: col,
onPrimary: Colors.white,
minimumSize: Size(160.0, 60.0),
textStyle: TextStyle(
fontSize: 24,
),
),
onPressed: onPress,
);
}
}
Passing null to the onPressed callback will disable the button.
If onPressed and onLongPress callbacks are null, then the button will be disabled.
https://api.flutter.dev/flutter/material/ElevatedButton-class.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With