user16357470
user16357470

Reputation:

How to remove default space between columns in Flutter?

How to remove space between this columns? I marked by red color space I want to remove, it should be sticky, I guess. Is it possible?

enter image description here

My code for trying to do this:

 child: Column(
                  children: [
                    Row(
                      children: [
                        Checkbox(
                            checkColor: Colors.green,
                            activeColor: Colors.green,
                            value: value,
                            onChanged: (value) {
                              value = value;
                            }),
                        Text(
                          'One',
                          style: GoogleFonts.montserrat(fontSize: 18),
                        ),
                      ],
                    ),
                    Row(
                      children: [
                        Checkbox(
                            checkColor: Colors.green,
                            activeColor: Colors.green,
                            value: value,
                            onChanged: (value) {
                              value = value;
                            }),
                        Text(
                          'two',
                          style: GoogleFonts.montserrat(fontSize: 18),
                        ),
                      ],
                    ),
                   

Upvotes: 0

Views: 69

Answers (2)

Ravindra S. Patil
Ravindra S. Patil

Reputation: 14775

Try below code and add visualDensity in your Checkbox widget

visualDensity - Its define checkbox's layout

Column(
      children: [
        Row(
          children: [
            Checkbox(
                visualDensity: VisualDensity(horizontal: -4, vertical: -4),
                checkColor: Colors.green,
                activeColor: Colors.green,
                value: value,
                onChanged: (value) {
                  value = value;
                }),
            Text(
              'One',
            ),
          ],
        ),
        Row(
          children: [
            Checkbox(
                visualDensity: VisualDensity(horizontal: -4, vertical: -4),
                checkColor: Colors.green,
                activeColor: Colors.green,
                value: value,
                onChanged: (value) {
                  value = value;
                }),
            Text(
              'two',
            ),
          ],
        ),
      ],
    ),

Result-> image

Upvotes: 0

Jahidul Islam
Jahidul Islam

Reputation: 12565

It's not Column issue. You got the space from checkbox. Just wrap your checkbox with sizebox and give them a specific height.

        Row(
          children: [
            SizedBox(
              height: 10,
              child: Checkbox(
                  checkColor: Colors.green,
                  activeColor: Colors.green,
                  value: value,
                  onChanged: (value) {
                    value = value;
                  }),
            ),
            Text(
              'One',
              //    style: GoogleFonts.montserrat(fontSize: 18),
            ),
          ],
        ),
        Row(
          children: [
            SizedBox(
              height: 10,
              child: Checkbox(
                  checkColor: Colors.green,
                  activeColor: Colors.green,
                  value: value,
                  onChanged: (value) {
                    value = value;
                  }),
            ),
            Text(
              'two',
              //   style: GoogleFonts.montserrat(fontSize: 18),
            ),
          ],
        ),
      ])

Upvotes: 1

Related Questions