skip to Main Content

enter image description here

How can i center my text "……" like this, thanks. Align or center widget or textAlign is not working, please help me
enter image description here

      Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Icon(
                                    Icons.visibility_off_outlined,
                                    color: Colors.black
                                        .withOpacity(0.25),
                                  ),
                                  Text(
                                    "..........",
                                    textAlign: TextAlign.center,
                                    style: TextStyle(
                                      color: Color(0xFF0E5699),
                                      fontSize: 32,
                                      fontWeight: FontWeight.w700,
                                    ),
                                  ),
                                ],
                              ),

Vertically center this text like an icon

2

Answers


  1. Your code is fine and already vertically center. Since you use "." so the dot will be in the bottom. If you want to create a center dot. Use bullet instead
    You can use u2022 to create a unicode bullet.

    Text(
      "u2022u2022u2022u2022u2022u2022",
      textAlign: TextAlign.center,
      style: TextStyle(
        color: Color(0xFF0E5699),
        fontSize: 32,
        fontWeight: FontWeight.w700,
      ),
    ),
    

    But I wonder what the purpose of your question. If you trying to create a TextField for password input purpose you can check here How to show/hide password in TextFormField?

    Login or Signup to reply.
  2. you can try this this will works for me.

    Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Icon(
            Icons.visibility_off_outlined,
            color: Colors.black.withOpacity(0.25),
          ),
          Container(
            padding: const EdgeInsets.only(bottom: 12),
            child: const Text(
              "........",
              textAlign: TextAlign.center,
              style: TextStyle(
                color: Color(0xFF0E5699),
                fontSize: 18,
                fontWeight: FontWeight.w700,
              ),
            ),
          ),
        ],
      ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search