When I have 2 radio buttons, where one is selected and the other isn't selected, one of them would be the active color, while the other is grey, so is there any way to change the unselected color from grey to white?
To change radio button color in Flutter, add fillColor property to the Radio widget. Inside the fillColor use the MaterialStateColor to add the color of your choice.
To change the Elevated button color on pess, you can use the ButtonStyle widget. Inside the ButtonStyle widget you can add the overlayColor property and assign the color based on state such as on press, on hover and on focued.
To show the RadioListTile as disabled, pass null as the onChanged callback. This widget shows a pair of radio buttons that control the _character field. The field is of the type SingingCharacter , an enum.
Steps to change TextField background color in FlutterStep 1: Locate the file where you have placed the TextField widget. Step 2: Inside the TextField widget, add the decoration parameter and assign the InputDecoration widget. Step 3: Inside the InputDecoration widget, add the filled parameter and set it to true .
Set unselectedWidgetColor
prop of theme in MaterialApp
like below:
return new MaterialApp(
title: 'xyz',
home: xyz(),
theme: ThemeData(
brightness: Brightness.dark,
unselectedWidgetColor:Colors.white
),
);
A useful tip that read the source code of radio.dart and you will get everything!
Sure, you have to change the ThemeData
of the container of your Radio buttons.
Assuming that you are using a Row
Container:
Theme(
data: ThemeData.dark(), //set the dark theme or write your own theme
child: Row(
children: <Widget>[
Radio(
//your attributes here...
),
Radio(
//your attributes here...
)
],
),
)
How it works?
Because if you check the code of the ThemeData
, you'll see this validation
unselectedWidgetColor ??= isDark ? Colors.white70 : Colors.black54;
then dark theme is using white70
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