Home > Back-end >  Not able to disable keyboard appearing automatically
Not able to disable keyboard appearing automatically

Time:12-15

The moment I come on this page the keyboard appears automatically, I want to disable that.When someone press on the enter email.I want keyboard to come at that time only. I have tried every thing nothing seems to work.Can someone please help me out

Form(
    child: Column(
      children: [
       TextFormField(
       // focusNode: fEmail,
       onFieldSubmitted: (term) {
          // fEmail!.unfocus();
          FocusScope.of(context).unfocus();
          // FocusScope.of(context).requestFocus(fPass);
       },
       textInputAction: TextInputAction.next,
       autofocus: true,
       style:TextStyle(color: Colors.black, fontSize: 30),
       decoration: InputDecoration(
          border: InputBorder.none,
          hintText: 'Enter Your Email',
          hintStyle: TextStyle(color: Colors.white60),
         ),
        ),
        TextFormField(
         onFieldSubmitted: (term) {
           fPass!.unfocus();
           FocusScope.of(context).unfocus();
           // FocusScope.of(context).requestFocus(fButton);
         },
         focusNode: fPass,
         textInputAction: TextInputAction.next,
         autofocus: true,
         style:TextStyle(color: Colors.black, fontSize: 30),
         decoration: InputDecoration(
          border: InputBorder.none,
          hintText: 'Enter Your PassWord',
          hintStyle: TextStyle(color: Colors.white60),
         ),
        ),
       ],
      ),
     ),

CodePudding user response:

You can use focus node to control the behaviour.

If you put autofocus=true in your code it will automatically focus on the topmost textfield widget in the current tree.

put autofocus = false or remove the parameter as it is false by default.

CodePudding user response:

Remove autofocus: true, from your code or set it to autofocus: false,

Refer Focus and text fields here

Refer autofocus property here

  • Related