'Keyboard disappearing when moving the focus to the next TextFormField flutter

This the form where I'm trying to move the focus. All is working fine till the field title, where I want to move it to a textField phone number but in doing so instead of moving the focus the soft keyboard disappears. I tried to attached scrollController to the SingleScrollView and then move it in onSaved in the textfield before this one I want to get focus: controller.singleSclollViewController.jumpTo(controller.singleSclollViewController.position.maxScrollExtent); But it is doing nothing.

This is the complete form with that problem

Form(
                    key: controller.formKey,
                    child: SingleChildScrollView(
                      controller: controller.singleSclollViewController,
                      padding: EdgeInsets.only(
                          bottom: MediaQuery.of(context).viewInsets.bottom),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          verticalSpaceMedium,
                          Image.asset(
                            'assets/graphics/data.png',
                          ),
                          Container(
                            padding: EdgeInsets.symmetric(horizontal: 40),
                            child: GetBuilder<HomeController>(
                                builder: (builderController) =>
                                    builderController.isPosition
                                        ? CustomTextField(
                                            autofocus: true,
                                            focusNode:
                                                controller.adressFocusNode,
                                            validate: (text) => controller
                                                .validateTextField(text),
                                            maxline: 4,
                                            minLine: 2,
                                            height: 80.h,
                                            width: 0.8.sw,
                                            controller:
                                                controller.adressController,
                                            color:
                                                AppColors.primaryColorShade,
                                                //adress
                                            lableText: 'адреса',
                                          )
                                        : CircularProgressIndicator()),
                          ),
                          verticalSpaceSmall,
                          Container(
                            padding: EdgeInsets.symmetric(
                              horizontal: 40,
                              vertical: 10,
                            ),
                            child: TypeAheadFormField<City>(
                                validator: (text) {
                                  if (globalController
                                      .doesSuggestionExist) {
                                    //there is no such available city
                                    return 'такого доступного міста немає';
                                  }
                                  return controller
                                      .validateTextField(text ?? '');
                                },
                                textFieldConfiguration:
                                    TextFieldConfiguration(
                                  controller: controller.cityController,
                                  decoration:
                                      outlineInputTextFormFieldStyle!
                                          .copyWith(
                                              label: Text(
                                    //city
                                    'місто',
                                    style: textfieldLableStyle,
                                  )),
                                ),
                                onSuggestionSelected: (City city) {
                                  controller.cityController.text =
                                      city.name;
                                  controller.nameFocusNode.requestFocus();
                                },
                                itemBuilder: (_, City city) {
                                  return ListTile(
                                    leading: Icon(Icons.location_city),
                                    title: Text(
                                      city.name,
                                      style: headingBlackStyle,
                                    ),
                                  );
                                },
                                suggestionsCallback: (pattern) async {
                                  return await globalController
                                      .getSuggestions(pattern, '');
                                }),
                          ),
                          verticalSpaceSmall,
                          OneLineTextField(
                              focusNode: controller.nameFocusNode,
                              onSubmit: () {
                                controller.nameFocusNode.unfocus();
                                controller.titleFocusNode.requestFocus();
                              },
                              keybordhType: TextInputType.name,
                              validator: (text) {
                                return controller
                                    .validateTextField(text ?? '');
                              },
                              //name/"Ім'я та прізвище"
                              lable: "Ім'я та прізвище",
                              maxLenght: 25,
                              controller: controller.nameController),
                          verticalSpaceSmall,
                          OneLineTextField(
                              onSubmit: () {
                                controller.singleSclollViewController
                                    .jumpTo(controller
                                        .singleSclollViewController
                                        .position
                                        .maxScrollExtent);
                                controller.phoneFocusNode.requestFocus();
                              },
                              focusNode: controller.titleFocusNode,
                              maxLenght: 25,
                              keybordhType: TextInputType.name,
                              validator: (text) {
                                return controller
                                    .validateTextField(text ?? '');
                              },
                              //title/"потрібен титул"
                              lable: 'Назва оголошення',
                              controller: controller.titleController),
                          verticalSpaceSmall,
                          OneLineTextField(
                              focusNode: controller.phoneFocusNode,
                              onSubmit: () => controller
                                  .descripotionFocusNode
                                  .requestFocus(),
                              maxLenght: 15,
                              keybordhType: TextInputType.number,
                              validator: (text) {
                                return controller
                                    .validateTextField(text ?? '');
                              },
                              //phone number/ "телефонний номер"
                              lable: 'телефонний номер',
                              controller:
                                  controller.contactNumberController),
                          verticalSpaceSmall,
                          Container(
                            padding: EdgeInsets.symmetric(horizontal: 40),
                            child: CustomTextField(
                              onSubmit: () => controller
                                  .descripotionFocusNode
                                  .unfocus(),
                              focusNode: controller.descripotionFocusNode,
                              maxLenght: 400,
                              validate: (text) =>
                                  controller.validateTextField(text),
                              maxline: 10,
                              minLine: 5,
                              height: 120.h,
                              width: 0.8.sw,
                              controller: controller.descriptionController,
                              color: AppColors.primaryColorShade,
                              //description
                              lableText: 'опис',
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source