Is there onStop callback in Flutter TextField?

156 views
Skip to first unread message

Abdullahi Abdi

unread,
Aug 11, 2020, 9:27:51 AM8/11/20
to Flutter Development (flutter-dev)
I want to show suggestions when user stops typing search keyword but before submit, now I see Textfield has onEdittingComplete which needs user to hit keyboard actions and onChange which executes at every character change and these are not good since suggestions need to display before user closes the keypoard and sending request to the server on each character is not good any solution between those two scenarios? 

Souvik Dutta

unread,
Aug 12, 2020, 12:53:09 AM8/12/20
to Abdullahi Abdi, Flutter Development (flutter-dev)
There are none other callbacks that these two. You don't need to send data to the server all the time. You can just import the data the server holds and do the same calculation locally. 

On Tue, Aug 11, 2020, 6:57 PM Abdullahi Abdi <jiin...@gmail.com> wrote:
I want to show suggestions when user stops typing search keyword but before submit, now I see Textfield has onEdittingComplete which needs user to hit keyboard actions and onChange which executes at every character change and these are not good since suggestions need to display before user closes the keypoard and sending request to the server on each character is not good any solution between those two scenarios? 

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/b838c3a2-9f09-4bd1-92f7-3698495e92e7o%40googlegroups.com.

jiin...@gmail.com

unread,
Aug 12, 2020, 1:40:21 AM8/12/20
to Flutter Development (flutter-dev)
How  to import server the server I didnt get that? what I was trying to do is fire getSuggestions event to bloc when user stops typing.

Souvik Dutta

unread,
Aug 12, 2020, 6:05:33 AM8/12/20
to jiin...@gmail.com, Flutter Development (flutter-dev)
I am not saying you to import the server but the data in the server as you said that you don't like the idea of making a request to the server every time the user stops typing.

Souvik flutter dev

jiin...@gmail.com

unread,
Aug 12, 2020, 8:56:15 AM8/12/20
to Flutter Development (flutter-dev)
The question is How I know that the user stoped typing?

Suzuki Tomohiro

unread,
Aug 12, 2020, 9:06:36 AM8/12/20
to jiin...@gmail.com, Flutter Development (flutter-dev)
I don’t think it’s possible to tell a user stops a typing, because immediately after your app “thinks” a user stops typing, the user can type another character.

I guess what you want is a timer. You can set a timer of no user input for 1 second, for example.

Souvik Dutta

unread,
Aug 12, 2020, 11:44:56 AM8/12/20
to Abdullahi Abdi, Flutter Development (flutter-dev)
onChanged is the called everytime a user changes the content of the textfield. You can use this to get when the user finishes typing. 

jiin...@gmail.com

unread,
Aug 12, 2020, 12:39:08 PM8/12/20
to Flutter Development (flutter-dev)

if I do server call on every character user enters that won't be ok

jiin...@gmail.com

unread,
Aug 12, 2020, 12:39:51 PM8/12/20
to Flutter Development (flutter-dev)
may be this can give me solution but can u give sample?

Souvik Dutta

unread,
Aug 12, 2020, 1:13:25 PM8/12/20
to jiin...@gmail.com, Flutter Development (flutter-dev)
Why will you be doing server calls? What data does the server store? 

Suzuki Tomohiro

unread,
Aug 12, 2020, 1:30:24 PM8/12/20
to jiin...@gmail.com, Flutter Development (flutter-dev)
Cancel the timer when the user type any character.


jiin...@gmail.com

unread,
Aug 13, 2020, 11:28:04 AM8/13/20
to Flutter Development (flutter-dev)

I want to show suggestions to the user by sending the keyword typed by the user to the server and returning names so he can choose between them
Reply all
Reply to author
Forward
0 new messages