Flutter : Keyboard pops up after Dialog is destroyed

1k views Asked by At

Problem :

When login button is pressed, a progress indicator is shown. But, when it's done, keyboard automatically pops up even if it was not showing eariler.

What I think :

I think that because the last focus was on TextField, the current focus is switched back onto it after the process.

What my code is doing :

On login button pressed, it triggers showDialog method. After that it waits (await) for the process to finish. After that, Navigator.pop(context) is called so the Dialog can be destroyed.

And that's when the keyboard shows up again.

Visual :

GIF

1

There are 1 answers

0
Yadu On BEST ANSWER

before showing the dialogue, do this,FocusScope.of(context).unfocus();