Search code examples
flutterdarttogglebutton

How to make ToggleButtons with text under icon


I'm having a bit of a hard time with this idea.

The goal is to have a row of Toggle Icons with text that can overflow onto a second line.

The issue I'm having with the ToggleButtons is that I can't seem to place text underneath each icon.

I currently have a Map<String, Icon> where the string is the text I want below the Icon from that Map.

Is there an easy/possible way to do this?


Solution

  • Yea, you can achieve this by using the Column widget.

    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Icon(Icons.access_alarm),
        SizedBox(height: 5.0,),
        Text("Text"),
      ],
    );