vendredi 24 juillet 2020

How can we create a checkbox in flutter with long label?

enter image description here I'am trying to achieve something like this. I am new to Flutter.

I have tried

 Wrap(
//                      alignment: WrapAlignment.center,
                      crossAxisAlignment: WrapCrossAlignment.center,
                      direction: Axis.horizontal,
                      children: <Widget>[
                        Checkbox(value: false, onChanged: null),
                        RichText(
                          overflow: TextOverflow.visible,
                          textAlign: TextAlign.left,
                          text: TextSpan(
                              text: 'By continuing you agree to our ',
                              style: TextStyle(
                                  color: Colors.grey,
                                  fontWeight: FontWeight.normal,
                                  fontSize: 14),
                              children: [
                                TextSpan(
                                  text: 'Terms of Service, Privacy Policy,',
                                  style: TextStyle(
                                      color: Theme.of(context).primaryColor,
                                      fontWeight: FontWeight.w600,
                                      fontSize: 14),
                                ),
                                TextSpan(
                                  text: 'and our ',
                                  style: TextStyle(
                                      color: Colors.grey,
                                      fontWeight: FontWeight.w600,
                                      fontSize: 14),
                                ),
                                TextSpan(
                                  text: 'Notification Settings.',
                                  style: TextStyle(
                                      color: Theme.of(context).primaryColor,
                                      fontWeight: FontWeight.w600,
                                      fontSize: 14),
                                ),
                              ]),
                        ),
                      ],
                    ),

This is what I am getting2

3 This is code that I have tried But I am getting like this. Is there any other way to align text and checkbox horizontally aligned and the rest of the text wrapped.




Aucun commentaire:

Enregistrer un commentaire