OiO.lk Blog Android how to remove or hide default icon when obscureText is true on flutter
Android

how to remove or hide default icon when obscureText is true on flutter


i use Flutter (Channel stable, 3.7.6, on Microsoft Windows [Version 10.0.19042.928], locale en-US)
my case is i need to remove default icon on textField when obscureText = true, because i use suffixIcon on decoration input.
enter image description here
my code like this :

Padding(
            padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: TextField(
              obscureText: _obscured,  
              controller: _password,
              textInputAction: TextInputAction.done,
              keyboardType: TextInputType.visiblePassword,
              decoration: InputDecoration(
                  icon: Icon(Icons.lock,
                      size: 32,
                      color: Colors.black),
                  labelText: "Password",
                  // hintText: "Password",
                  labelStyle: TextStyle(
                      color: Colors.black),
                  suffixIcon: IconButton(
                     icon: Icon(_obscured ? Icons.visibility_off : Icons.visibility),
                     onPressed: () {
                       setState(() {
                           _obscured = !_obscured;
                         },
                       );
                     },
                   ),
                // alignLabelWithHint: false,
                // filled: true,
              ),
            ),
          ),

i need solution for this case. thank you before



You need to sign in to view this answers

Exit mobile version