Search code examples
flutterradio-button

Flutter RadioListTile change Radio(icon) color


I have trouble changing Radio List Tile icon color. I tried to use ListTileTheme but not worked. By the way, I'm using RadioListTile in a dialog but I don't think that this affects it.

Code.

ListTileTheme(
   iconColor: AppColors.green,
   textColor: AppColors.green,
   child: SimpleDialog(
   shape:
   RoundedRectangleBorder(
   borderRadius:
   BorderRadius
   .circular(10),
   ),
   title: Text(
   "Select Restaurant",
   style: Theme.of(context)
   .textTheme
   .headline3,
   textAlign:
   TextAlign.center,
   ),
   children: [
   Divider(),
   RadioListTile(
   title: const Text(
   'Name and Address'),
   value: 1,
   groupValue:
   _isRadioSelected,
   onChanged: (v) {
   setState(() {
   _isRadioSelected =
   v;
   });
   },
   ),
   ],
   ),
   );

Solution

  •  Theme(
            data: Theme.of(context).copyWith(
                unselectedWidgetColor: Colors.green,
                disabledColor: Colors.green
            ),
            child: RadioListTile(
              title: const Text('Name and Address'),
              value: 1,
              groupValue: _isRadioSelected,
              onChanged: (v) {
                setState(() {
                  _isRadioSelected = v;
                });
              },
            ),
          )
    

    Use Theme for change some theme param in current widget. enter image description here