TextField without keyboard

121 views
Skip to first unread message

Hekhy

unread,
Dec 26, 2020, 8:48:58 PM12/26/20
to Flutter Development (flutter-dev)
I am making a calculator and I have tried to do it by putting a textfield, but I want the keyboard not to appear if the texfield is focused, I have tried with systemchannel of services.dart and other things that make the keyboard not appear when you do tap, but if you select the text to copy it, the keyboard will appear again. My question is why isn't there simply a property in the textfield that makes the virtual keyboard unable to appear? It would be very helpful since to make the calculator I have made my own keyboard using widgets.

Suzuki Tomohiro

unread,
Dec 26, 2020, 8:59:49 PM12/26/20
to Flutter Development (flutter-dev)
TextField is for users to edit the text (with their keyboard). If you don’t need keyboards, how about using SelectableText?

On Sat, Dec 26, 2020 at 20:49 Hekhy <titocri...@gmail.com> wrote:
I am making a calculator and I have tried to do it by putting a textfield, but I want the keyboard not to appear if the texfield is focused, I have tried with systemchannel of services.dart and other things that make the keyboard not appear when you do tap, but if you select the text to copy it, the keyboard will appear again. My question is why isn't there simply a property in the textfield that makes the virtual keyboard unable to appear? It would be very helpful since to make the calculator I have made my own keyboard using widgets.

--
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/30179255-d941-423b-9d92-5b66d0429c1bn%40googlegroups.com.

Hekhy

unread,
Dec 26, 2020, 9:15:18 PM12/26/20
to Flutter Development (flutter-dev)

Yes, it's a good idea, but it still doesn't work for what I want because I can't edit the text once it's written, I can only select it and copy it. It is also a good contribution and I thank you. I have also tried EditableText but it behaves almost the same as the textfield and continues to teach the keyboard.

Suzuki Tomohiro

unread,
Dec 26, 2020, 9:29:53 PM12/26/20
to Flutter Development (flutter-dev)
> I can't edit the text once it's written

Your keyboard updates the content of SelectableText. Or maybe I need to understand what your keyboard does.

Hekhy

unread,
Dec 26, 2020, 9:42:39 PM12/26/20
to Suzuki Tomohiro, Flutter Development (flutter-dev)
My keyboard are widgets, specifically FlatButton, that receive a Text to distinguish each button and that in the onPressed property, I tell it to edit the controler.text of the texfield and thus add the value of the string that each button has to that textfield to be written and displayed on the screen. That is why I do not need the device's own keyboard, but only that keyboard that I have created is used, but the device always comes out, I have achieved that it does not appear if you only tap on the keyboard, but if you keep the tap to select the text exits the device keyboard again.

You received this message because you are subscribed to a topic in the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flutter-dev/GP2EX2zzRt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CAHWORbqjYRYz9sJ-y9hVHLzL_r4MUeAGhJR08k0SpQK5fNduFw%40mail.gmail.com.

Suzuki Tomohiro

unread,
Dec 26, 2020, 10:09:41 PM12/26/20
to Flutter Development (flutter-dev)
Thank you for explanation. Yes, you want to control the content of SelectableText by your keyboard, in a similar timing as you update “controller.text” (don’t forget to call setState method).
Reply all
Reply to author
Forward
0 new messages