Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overscroll value has no effect when manually focusing on element after the first time #136

Open
yosikal opened this issue Dec 31, 2020 · 5 comments

Comments

@yosikal
Copy link

yosikal commented Dec 31, 2020

I set overscroll to 150. First time focusing on TextField the field indeed is scrolled correctly per the overscroll value. However, after doing that, if I focus manually (tapping) on the next text field, nothing happens.

@yosikal yosikal changed the title overscroll value has no effect when manually focusing on element after the first time Overscroll value has no effect when manually focusing on element after the first time Dec 31, 2020
@diegoveloper
Copy link
Owner

Can you attach a video/gif + minimum code sample ?

@yosikal
Copy link
Author

yosikal commented Dec 31, 2020

Sure, here is a video. Please note that I move between the fields by tapping them and not by using the arrows.

RPReplay_Final1609191144.MP4

Also, code sample that demonstrates the issue:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:keyboard_actions/keyboard_actions.dart';

class TestScreen extends StatefulWidget {
  TestScreen({Key key}) : super(key: key);

  @override
  _TestScreenState createState() => _TestScreenState();
}

class _TestScreenState extends State<TestScreen> {
  final FocusNode _nodeText1 = FocusNode();
  final FocusNode _nodeText2 = FocusNode();
  final FocusNode _nodeText3 = FocusNode();

  KeyboardActionsConfig _buildConfig(BuildContext context) {
    return KeyboardActionsConfig(
      keyboardActionsPlatform: KeyboardActionsPlatform.ALL,
      keyboardBarColor: Colors.grey[200],
      nextFocus: true,
      actions: [
        KeyboardActionsItem(
          focusNode: _nodeText1,
        ),
        KeyboardActionsItem(
          focusNode: _nodeText2,
        ),
        KeyboardActionsItem(
          focusNode: _nodeText3,
        ),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      resizeToAvoidBottomInset: false,
        child: KeyboardActions(
          overscroll: 150,
      config: _buildConfig(context),
      child: Container(
        child: Padding(
          padding: const EdgeInsets.only(left: 20, right: 20),
          child: Form(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                SizedBox(
                  height: 500,
                  width: 200,
                ),
                TextFormField(
                  keyboardType: TextInputType.text,
                  focusNode: _nodeText1,
                  decoration: InputDecoration(
                    hintText: "Input Number",
                  ),
                ),
                TextFormField(
                  keyboardType: TextInputType.text,
                  focusNode: _nodeText2,
                  decoration: InputDecoration(
                    hintText: "Input Text with Custom Done Button",
                  ),
                ),
                TextFormField(
                  keyboardType: TextInputType.text,
                  focusNode: _nodeText3,
                  decoration: InputDecoration(
                    hintText: "Input Number with Custom Action",
                  ),
                ),
                SizedBox(
                  height: 1000,
                  width: 200,
                ),
              ],
            ),
          ),
        ),
      ),
    ));
  }
}

@diegoveloper
Copy link
Owner

hmm but you don't need overscroll there since you have enough space to see the textfield.

@yosikal
Copy link
Author

yosikal commented Jan 1, 2021

I was hoping to get user experience like Booking.com or Airbnb have in their checkout forms. It's very useful from the user perspective to be able to see and tap on the next field.

@BenjiFarquhar
Copy link
Contributor

@diegoveloper For some reason overscroll is just detecting the error message and sizing correctly to that. It is actually fine behaviour, just unexpected as the argument is a custom double.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants