skip to Main Content

I have created ‘Rememnber Password’ UI in my login screen with below code which is inside Row() widget :

                 Wrap(
                      alignment: WrapAlignment.center,
                      children: [
                        Checkbox(
                          checkColor: Colors.white,
                          value: isChecked,
                          onChanged: (bool? value) {
                            setState(() {
                              isChecked = value!;
                            });
                          },
                        ),
                        Text(
                          "remember_me",
                          style: theme.textTheme.bodySmall,
                        ).tr()
                      ],
                    ),

But the issue is Checkbox looks good in center, but the Text to the right side of the checkbox has some space below it and it looks little up and not vertically in center.

What might be the issue or how can I make the ‘Remember Me’ text vertically in center?

2

Answers


  1. You can try this code :

     Wrap(
      crossAxisAlignment: WrapCrossAlignment.center,
                              children: [
                                Checkbox(
                                  checkColor: Colors.white,
                                  value: isChecked,
                                  onChanged: (bool? value) {
                                    setState(() {
                                      isChecked = value!;
                                    });
                                  },
                                ),
                                Text(
                                  "remember_me",
                                  style: theme.textTheme.bodySmall,
                                ).tr()
                              ],
                            ),
    
    Login or Signup to reply.
  2. Just add one attribute of Wrap Widget,

     Wrap(
         ...      
        crossAxisAlignment: WrapCrossAlignment.center,
         ...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search