Home > OS >  Not changing the border color in check box, is there any another way?
Not changing the border color in check box, is there any another way?

Time:12-19

I am Trying to change the color in checkbox, but not getting the color, it showing the default color. If anyone know how it change the border color, please share..

This is the Actual code:

     Checkbox(
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(5),
                            side: BorderSide(
                              color: Colors.blue,
                              width: 1.1,
                            ),
                          ),
                    ),

But it showing default color

CodePudding user response:

Simply, this should do:

Checkbox(
          fillColor: MaterialStateProperty.all(Colors.blue),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(5),
          ),
          value: false,
          onChanged: (bool? value) {...},
        ),

Also Refer to This Video for helpful info

I'd advise you to play with the following parameters

  1. overlayColor
  2. SplashRadius
  3. side

It will help you better understand the Checkbox widget.

So, there you go. Problem Solved! Happy Coding!

  • Related