[Solved] Not able to disable keyboard appearing automatically

Question

Asked by Kavach D on December 15, 2021 (source).

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),
         ),
        ),
       ],
      ),
     ),

Answer

Question answered by Chandan P (source).

You can use focus Node to control the behaviour. if you put autofocus: true if your code. this line will automatically focus on the top most Textfield widget.

put autofocus: false in our code it will be disable your keyboard which is opening automatically in the text filed.

Refer Focus and text fields: here

Refer autofocus property: here

FLUTTER FLUTTER-LAYOUT
SHARE: