0

here you can see what I currently have: (I'm currently not allowed to insert this picture). I have two TabBars with two Radio Buttons each in a ListView, but it looks horrible. I would like to place the radio buttons one below the other, regardless of the length of the strings.

Here is my code:

 return ListView(
      children: <Widget>[
        //..
        ),
        Container(
            child: ButtonBar(
          alignment: MainAxisAlignment.spaceBetween, // I also tried every other setting here, but none works for me
          children: <Widget>[
            Radio(
              value: 1,
              groupValue: _selectedRadio,
              activeColor: corpColorPrimary,
              onChanged: (val) => setSelectedRadio(val),
            ),
            Text("a long String"),
            Radio(
              value: 2,
              groupValue: _selectedRadio,
              activeColor: corpColorPrimary,
              onChanged: (val) => setSelectedRadio(val),
            ),
            Text("Another long String"),
          ],
        )),

        Container(
          child: ButtonBar(
            alignment: MainAxisAlignment.start,
            children: <Widget>[
              Radio(
                value: 1,
                groupValue: _selectedRadio,
                activeColor: corpColorPrimary,
                onChanged: (val) => setSelectedRadio(val),
              ),
              Text("Hi"),
              Radio(
                value: 2,
                groupValue: _selectedRadio,
                activeColor: corpColorPrimary,
                onChanged: (val) => setSelectedRadio(val),
              ),
              Text(":)"),
            ],
          ),
        ),
        RaisedButton(
          child: Text("Next"),
          onPressed: () {},
        ),

How can I align the Radio buttons correctly?

DarkMath
  • 1,089
  • 2
  • 15
  • 29

2 Answers2

0

you can use Spacer(), widget between each Container(), widget and adjust them.

Lilly
  • 180
  • 1
  • 16
0

Take Row and in Row take two columns that will solve your issue.

Meet Patel
  • 189
  • 9