When focussing on the TextField, the keyboard hides over the TextField. Below I attached a screenshot with code. Please guide me in fixing this issue.
signup
This one worked for me
signup.dart
import 'package:flutter/material.dart';
import 'package:yfobs/utilities/desc.dart';
ScrollController _scrollController; //<==
class SignUpPage extends StatefulWidget {
static String tag = 'SignUpPage';
@override
_SignUpPageState createState() => _SignUpPageState();
}
class _SignUpPageState extends State {
//Implementing scrollController by detecting keyboard //<==
bool scrolled = false;
_scrollListener() {
if (!scrolled && MediaQuery.of(context).viewInsets.bottom != 0) {
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
duration: Duration(milliseconds: 100),
curve: Curves.easeOut,
);
scrolled = true;
}
if (MediaQuery.of(context).viewInsets.bottom == 0) {
scrolled = false;
}
}
@override
void initState() {
_scrollController = ScrollController();
_scrollController.addListener(_scrollListener);
super.initState();
}
Widget build(BuildContext context) {
.
.
//rest is same
.
.
}