I'm trying to change background color of not selected toggle buttons. I guess the background color is set to transparent by default now and I just can not change it. I tried to populate the buttons with expanded colored containers but that didn't work
Here is picture
Here is code
Container(
child: ToggleButtons(
borderRadius: BorderRadius.circular(5),
selectedColor: Colors.white,
fillColor: Colors.blue,
//renderBorder: false,
children: [Text('Option1'), Text('Option2'), Text('Option3')],
isSelected: [true, false, false],
onPressed: (d) {},
),
)
True, not selected toggle buttons are transparent... couldn't find anything about setting the background color for them in the official documentation.
So, how about setting the background of the parent container?
Is this solution satisfactory for your needs?
Container(
padding: EdgeInsets.zero,
decoration: BoxDecoration(
color: Colors.yellow,
border: Border.all(color: Colors.black, width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
child: ToggleButtons(
selectedColor: Colors.white,
borderRadius: BorderRadius.circular(5),
fillColor: Colors.blue,
children: [Text('Option1'), Text('Option2'), Text('Option3')],
isSelected: [true, false, false],
onPressed: (d) {},
),
),