dimanche 9 octobre 2022

how to do it ?-> Among the two checkboxes in a row, the user can select only one checkbox at a time

in flutter -> Among the two checkboxes in a row, the user can select only one checkbox at a time. how can i do it.here i have use ("RoundCheckBoxCus" because i need this type of round checkbox with icon) checkbox package. ...from my code user can select 2checkbox at a time, but i need only one can select at a time.in a row.

please check my code->

 Container(
                    margin: EdgeInsets.only(
                        top: ScreenUtil().setHeight(352),
                        left: MediaQuery.of(context).size.width * 0.72),
                    child: Row(
                      children: <Widget>[
                        // SizedBox(
                        //   height: 540.h,
                        // ),
                        SizedBox(
                          width: 13.w,
                        ),
                        Container(
                          child: RoundCheckBoxCus(
                            onTap: (selected) => print(selected),
                            uncheckedColor: Colors.transparent,
                            uncheckedWidget: Container(
                              decoration: BoxDecoration(
                                  color: Colors.white,
                                  border: Border.all(
                                    color: Colors.transparent,
                                  ),
                                  borderRadius: BorderRadius.all(Radius.circular(20.sp))
                              ),
                              child:  Icon(Icons.check,size:15.sp,),
                            ),
                            size: 19.w,
                          ),
                        ),
                        SizedBox(width: 30.w,),
                        Container(
                          child: RoundCheckBoxCus(

                            onTap: (selected) => {
                            setState(() {
                            isChecked = true;
                            },
                            )},
                            uncheckedColor: Colors.transparent,
                            uncheckedWidget: Container(
                              decoration: BoxDecoration(
                                  color: Colors.white,
                                  border: Border.all(
                                    color: Colors.transparent,
                                  ),
                                  borderRadius: BorderRadius.all(Radius.circular(20.sp))
                              ),
                              child:  Icon(Icons.check,size:15.sp,),
                            ),
                            size: 19.w,
                          ),
                        ),
                        SizedBox(
                          width: 13.w,
                        ),
                      ],
                    ),
                  ),

in flutter -> Among the two checkboxes in a row, the user can select only one checkbox at a time. how can i do it.here i have use RoundCheckBoxCus checkbox package




Aucun commentaire:

Enregistrer un commentaire