Shortcut Keyboard For TextField Widget — Stack Secrets

Sovit Poudel
Stack Secrets
Published in
1 min readJul 27, 2019

In this post, we will add a shortcut keyboard for TextField widget in Flutter app.

Introduction

Let’s say you have a user input field where users type in certain data. If user has to type a certain word or character frequently, you might want to provide a shortcut to such texts.

For an example, users might have to frequently type in numbers such as 100, 200, 500 etc. on a TextField. In this post, we will learn to create a shortcut keyboard just for that purpose.

We are going to add this feature on our Expense Manager app continuing from previous post. At the end of this post, we will have achieved the following:

  1. Create a shortcut keyboard for TextField widget in flutter.
  2. Set shortcut keyboard visible only when the TextField is set in focus.
  3. Positioned the shortcut keyboard on top of the device keyboard.
  4. Update the TextField's value based upon the shortcut key pressed.
  5. Set the cursor position of TextField programmatically.

View complete post here: Shortcut Keyboard For TextField Widget

Originally published at http://stacksecrets.com on July 27, 2019.

--

--