Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The argument type 'BorderRadius?' can't be assigned to the parameter type 'BorderRadius' flutter

I am having an InputDecoration which has the border property, If a certain condition is true i apply OutlineInputBorder or else i set it to null which is working correctly. I also want to apply borderRadius if a certain condition is true but i am getting the error The argument type 'BorderRadius?' can't be assigned to the parameter type 'BorderRadius' if i apply the borderRadius without the if statement its just working correctly what might be the issue. Below is my code

decoration: InputDecoration(
                                        labelText:
                                            enableDropDownFormFieldLabelText
                                                ? "Select Car"
                                                : null,
                                        border:
                                            enableCustomizableDropDownFormFieldOutlineInputBorder
                                                ? OutlineInputBorder(
                                                    borderRadius: enableCustomizableDropDownFormFieldOutlineInputBorderBorderRadius
                ? BorderRadius.circular(15): null)
                                                : null,
                                        contentPadding: const EdgeInsets.only(
                                            left: 10, right: 5))

like image 766
Emmanuel Njorodongo Avatar asked Oct 27 '25 23:10

Emmanuel Njorodongo


1 Answers

BorderRadius can not be null. Use BorderRadius.circular(0) istead.

decoration: InputDecoration(
                                    labelText:
                                        enableDropDownFormFieldLabelText
                                            ? "Select Car"
                                            : null,
                                    border:
                                        enableCustomizableDropDownFormFieldOutlineInputBorder
                                            ? OutlineInputBorder(
                                                borderRadius: enableCustomizableDropDownFormFieldOutlineInputBorderBorderRadius
            ? BorderRadius.circular(15): BorderRadius.circular(0))
                                            : null,
                                    contentPadding: const EdgeInsets.only(
                                        left: 10, right: 5))
like image 55
Vipul Tyagi Avatar answered Oct 29 '25 14:10

Vipul Tyagi