luhluh
luhluh

Reputation: 187

How to handle keyboard actions or add functions in keyboard TextInputAction in Flutter/Dart?

I have simple TextField below. I wanted to call my search function when I pressed the TextInputAction button of the SofInput Keyboard.

TextField(
    keyboardType: TextInputType.phone,
    textInputAction: TextInputAction.search,
    decoration: InputDecoration(hintText: 'Enter Number'),
),

// Example only
void myCustomFunction() => SearchNumber();

enter image description here

Upvotes: 0

Views: 2322

Answers (1)

hewa jalal
hewa jalal

Reputation: 961

when you press that button the onSumbitted method get called so you can do this:

onSubmitted: (val) => searchNumber(),

Upvotes: 6

Related Questions