Home > front end >  How to horizontal Icon and text on flutter?
How to horizontal Icon and text on flutter?

Time:10-23

My output

enter image description here

How to align horizontally this Icon , Text and radio button.Radio button and text display nicely but Icon and text are not align horizontally. How make this?

my code

ListTile(
                          leading: Icon(
                            Icons.brightness_1,
                            color: Colors.black,
                            size: 13,
                          ),
                          minLeadingWidth: 2,
                          title: Text("Can you understand?"),
                          trailing: Radio(
                            value: "talk",
                            groupValue: level,
                            onChanged: (value) {
                              setState(() {
                                level = value.toString();
                              });
                            },
                          ),
                        ),

CodePudding user response:

You can try this for leading:

leading: Container(
            height: 24,
            width: 24,
            alignment: Alignment.center,
            child: Icon(
              Icons.brightness_1,
              color: Colors.black,
              size: 13,
            ),
          ),

enter image description here

CodePudding user response:

enter image description hereTry this:

ListTile(
  leading: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Icon(
          Icons.brightness_1,
          color: Colors.black,
          size: 13,
        ),
      ],
    ),
  minLeadingWidth: 2,
  title: Text("Can you understand?"),
  trailing: Radio(
    value: "talk",
    groupValue: "level",
    onChanged: (value) {
    },
  ),
),
  • Related