mardi 4 septembre 2018

Flutter Checkbox not working inside BottomSheet

I am new to Flutter and working on filtering using Checkbox. But when I click on the checkbox, it does not become active when I click the checkbox. But it activates when clicked outside it at a certain position. I have initialised isChecked=False already.

Here is my code:

return Scaffold(
body:
showModalBottomSheet(context: context, builder: (BuildContext context){
                       return Container(
                         height: screenHeight/3,
                         padding: const EdgeInsets.all(15.0),
                         child: Column(
                           mainAxisAlignment: MainAxisAlignment.start,
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: <Widget>[
                             Text(
                               "Filters",
                                 style: TextStyle(
                                     color: theme.orangePrimaryColor,
                                     fontSize: 13.0,
                                     fontWeight: FontWeight.w600
                                 )
                             ),
                             ExpansionTile(
                               title: Text("..."),
                               children: <Widget>[
                                 Row(

                                   children: <Widget>[
                                     Text("...",
                                         style: TextStyle(
                                             color: theme.filterColor,
                                             fontSize: 13.0,
                                             fontWeight: FontWeight.w400
                                         )
                                     ),
                                     new Checkbox(activeColor: Colors.blue,
                                       value: isChecked,
                                       onChanged: (bool value){
                                         setState(() {
                                           isChecked = value;
                                         }
                                         );
                                       }
                                     ),
                                   ],
                                 )
                               ],
                             )
                           ],
                         ),
                       );
                     }
                     );
                   }
                   ),
               )
             ]
         ),
       ),
     ),
   ),
 ),
)




Aucun commentaire:

Enregistrer un commentaire