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.
Asked
Active
Viewed 123 times
0

CopsOnRoad
- 237,138
- 77
- 654
- 440

Gourav Kandoria
- 47
- 3
-
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 Answers
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:

CopsOnRoad
- 237,138
- 77
- 654
- 440