What I want:
I want to create a button like the one on TabBar(); , where it's like a ToggleButton() with an underline.
well, The functionality of this button should be similar to ToggleButton(), refer here. for toggleButton class.
What I have Tried so far:
ToggleButtons(
borderRadius: BorderRadius.zero,
children: [
RichText(
text: TextSpan(
text: "Today",
style: TextStyle(
color: Colors.black, fontSize: 15),
children: [
TextSpan(
text:
" ${offline.length.toString()} Slots",
style: TextStyle(color: Colors.green))
],
),
),
RichText(
text: TextSpan(
text: "Today",
style: TextStyle(
color: Colors.black, fontSize: 15),
children: [
TextSpan(
text:
" ${offline.length.toString()} Slots",
style: TextStyle(color: Colors.green))
],
),
),
],
isSelected: isSelected,
onPressed: (int index) {
setState(
() {
for (int buttonIndex = 0;
buttonIndex < isSelected.length;
buttonIndex++) {
if (buttonIndex == index) {
isSelected[buttonIndex] = true;
} else {
isSelected[buttonIndex] = false;
}
}
},
);
},
),
output of the above code:



