1

I have a question.

I have an application with various forms with textfields. In each form i noted that when i use tab button to switch fields, focus disappear from the fields and goes i dont know where.

I tried to use Focus widget to see if on tab the focus change, and it doesn't (only when the focus return to the first field, Focus return me that it is changed)

Someone could help me? Thanks you

This is a snippet of Login form

   

 

Focus(
     onFocusChange: ((value) => print("focus is changed")),
                      child: Column(
                        children: [
                          Semantics(
                            value: "Email",
                            child: TextFormField(
                              key: Key("Email"),
                              validator: (value) => emailValidator(value),
                              controller: _emailController,
                              
                            ),
                          ),
                          const SizedBox(height: 20),
                          Semantics(
                            value: "Password",
                            child: TextFormField(
                              key: Key("Password"),
                              validator: (value) =>
                                  formRequiredValidation("password", value),
                              textInputAction: TextInputAction.done,
                              obscureText: _isTypePassword,
                              controller: _passwordController,
                              onChanged: (value) {
                                setState(() {});
                              },
                              onFieldSubmitted: (String value) => _onSubmit(),
                              
                            ),
                          ),
                          const SizedBox(height: 20),
                          SizedBox(
                            width: double.infinity,
                            height: 45,
                            child: ElevatedButton(
                              key: Key("Accedi"),
                              onPressed: _onSubmit,
                              child: const Text(
                                "ACCEDI",
                                
                              ),
                            ),
                          ),
                          const SizedBox(height: 20),
                          GestureDetector(
                            onTap: () {},
                            child: Text(
                              "Hai dimenticato la password?",
                              style: TextStyle(
                                  color: Theme.of(context).primaryColor),
                            ),
                          ),
                          const SizedBox(height: 20),
                          GestureDetector(
                            onTap: () {},
                            child: Text(
                              "Non sei ancora registrato?",
                              style: TextStyle(
                                  color: Theme.of(context).primaryColor),
                            ),
                          ),
                        ],
                      ),
                    ),

CesareIsHere
  • 123
  • 1
  • 10

1 Answers1

0

Good morning, we solved the problem by deleting the web folder and having it recreate in flutter. We noticed that the new generated index.html file contains a third of the code compared to the old one. It should be noted that the project started with Flutter 2 and was subsequently upgraded to Flutter 3. Also note that with Flutter 3 important improvements have been released for the web part, including the ability to set up a loading page before starting the app or before loading it, along with other things. Since it wasn't there in Flutter 2, we created a loading page ourselves. it is our opinion that these changes resulted in the focus on objects not working. Thanks to all for the precious collaboration.

CesareIsHere
  • 123
  • 1
  • 10