Multiple cursor in form's TextFormField flutter Multiple cursor in form's TextFormField flutter dart dart

Multiple cursor in form's TextFormField flutter


As the OP answered in comment section.

Declare all the focusNode from local variables to global scope that solved the problem.

I'm using focusNode in Widget build(BuildContext context) method. Which is showing multiple cursors.

class _LoginScreenState extends State<LoginScreen> {@override  Widget build(BuildContext context) {    final FocusNode _emailFocus = FocusNode();    final FocusNode _passwordFocus = FocusNode();

SOLUTION - Declare focusNode Globally.

class _LoginScreenState extends State<LoginScreen> {  final FocusNode _emailFocus = FocusNode();  final FocusNode _passwordFocus = FocusNode();  @override  Widget build(BuildContext context) {


Removed the local scope focusNode from this method.

Widget getWidgetRegistrationCard() {final FocusNode _passwordEmail = FocusNode(); //removed final FocusNode _passwordFocus = FocusNode(); //removedfinal FocusNode _passwordConfirmFocus = FocusNode(); //removed.. .} 

& declare it globally solved the problem for me.

class RegisterScreen extends StatefulWidget {@override_RegisterScreenState createState() => _RegisterScreenState();}class _RegisterScreenState extends State<RegisterScreen> {static var _keyValidationForm = GlobalKey<FormState>();final FocusNode _passwordEmail = FocusNode();  //added globallyfinal FocusNode _passwordFocus = FocusNode();  //added globallyfinal FocusNode _passwordConfirmFocus = FocusNode();  //added globally.. .