jeudi 21 octobre 2021

how to enable checkbox with tapping on text in flutter?

I have a checkbox with a text next to the checkbox I want when user tap on text the checkbox be enable/disable, how can i do that?

  Widget buildRememberCb() {
    return Container(
      height: 200,
      child: Row(
        textDirection: TextDirection.rtl,
        children: [
          Theme(
            data: ThemeData(unselectedWidgetColor: Colors.white),
            child: Checkbox(
              value: isRememberMe,
              checkColor: Color(0xfff44336),
              activeColor: Colors.white,
              onChanged: (value) {
                setState(() {
                  isRememberMe = value!;
                });
              },
            ),
          ),
          Text(
            "Remember Me",
            style: TextStyle(
                fontWeight: FontWeight.w900, fontSize: 18, color: Colors.white),
          ),
        ],
      ),
    );
  }



Aucun commentaire:

Enregistrer un commentaire