0

In flutter, Raisedbutton has disabledColor option in its constructor but not any option to disable it? So how can someone apply the disabledColor when there is no information about whether RaisedButton is disabled or not.

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
  • I believe [this](https://stackoverflow.com/a/49354576/3266152) answers your question – flarkmarup Aug 11 '19 at 09:47
  • Possible duplicate of [How do I disable a Button in Flutter?](https://stackoverflow.com/questions/49351648/how-do-i-disable-a-button-in-flutter) – George Aug 11 '19 at 09:48

2 Answers2

1

If don't set onPressed callback, the button will be disabled.

RaisedButton(
  child:Text("Disabled)
)
Tree
  • 29,135
  • 24
  • 78
  • 98
0

You need to pass onPressed otherwise IDE will show error/warning. Use this,

RaisedButton(
  onPressed: null, // disables the button
  disabledColor: Colors.orange,
  child: Text("Disabled"),
)

Output:

enter image description here

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440