Scroll to textfield on focus

This commit is contained in:
Ivan Murashov
2018-03-09 10:57:11 +03:00
parent 19f1b7993d
commit 86e3f4ba4c
2 changed files with 92 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ class RegistrationScreen extends BaseScreen {
class RegistrationScreenState extends BaseState<RegistrationScreen> {
RegistrationScreenState(SqliteHelper helper, String app) : super(helper, app);
FocusNode _focusNode = new FocusNode();
@override
Widget build(BuildContext ctx) {
@@ -54,12 +55,15 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
@override
getTextWidget() {
return new TextField(
return new EnsureVisibleWhenFocused(
focusNode: _focusNode,
child: new TextField(
focusNode: _focusNode,
keyboardType: TextInputType.number,
decoration: new InputDecoration.collapsed(
hintText: getHintString(),
hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)),
onChanged: (text) => handleUserInput(text));
onChanged: (text) => handleUserInput(text)));
}
/// Возвращает кнопку регистрации.