Disable the input action button in the virtual keyboard when TextField is empty

This issue has been created since 2022-09-22.

Use case

I'd like to disable the search button in the virtual keyboard when the TextField is empty:

Proposal

On iOS, this can be implemented via enablesReturnKeyAutomatically.

huycozy wrote this answer on 2022-09-23

Hi @ryanheise, thanks for filing the issue.
I see there are some similar open issues addressing the case you described #93915, #30331
Closing this issue as a duplicate, so please follow up on these issues for further updates. You can leave there your comment and react an upvote to the original comment will help to raise the issue. Thank you!

ryanheise wrote this answer on 2022-09-23

This feature request is unrelated to #30331 because changing the button label dynamically is a different goal from disabling the button.

As for #93915 , that issue has a different and broader objective of being able to dynamically disable/enable the button at any time, which I'm not sure is even permitted by iOS. Rather, the native iOS API only allows you to follow a single preset behaviour of disabling the button when the text field is empty, and then automatically enabling it when you start typing. See the iOS documentation linked above. My feature request is specifically for that feature.

If I'm wrong, please let me know (i.e. which native API makes #93915 possible). But if #93915 is not actually possible, this present issue still is possible. If we close that issue, then this one should remain open.

huycozy wrote this answer on 2022-09-23

Hi @ryanheise
The reason I bring up the above 2 issues is that I am not sure if a feature when implemented will combine automation and disable/enable together.

With what you described above, I think it matches what the OP of issue #93915 is describing, please see #93915 (comment). It would be better if similar issues were solved in only one issue, so please leave a comment there for your thoughts and react an upvote to the original comment will help to raise the issue. It will make that issue clearer when implemented.

If you disagree, please write in the comments and I will reopen this issue and continue the discussion. Thanks!

ryanheise wrote this answer on 2022-09-23

As before, I don't think #93915 is actually possible. Please correct me if I'm wrong.

huycozy wrote this answer on 2022-09-25

Hi @ryanheise I reopen the issue for further discussions.

Why do you think that #93915 is impossible when you are also proposing the similar thing?

  • From your proposal:

I'd like to disable the search button in the virtual keyboard when the TextField is empty:

The app is Safari,The Go button is disabled if you enter nothing in the search bar.


please let me know (i.e. which native API makes #93915 possible)

Also, this is not known in advance, that's the reason why I suggested you should add your comment on that issue so people can see it and give more opinions on it before being implemented (e.g. using enablesReturnKeyAutomatically as you suggested)

ryanheise wrote this answer on 2022-09-25

It sounds like #93915 has proposed a more general feature. If you could have an option to enable/disable the TextField, that would also solve my use case:

TextField(enableInputAction: true, ...);

But it would also solve a broader range of use cases. For example, with that ability, you would also be able to perform validation after each keystroke and disable the action button until the input is valid. You could decide on the condition for when to enable/disable the button, including when the text field is empty. Having such a feature would be nice.

But I'm just proposing a feature that is more narrow:

TextField(autoEnableReturnKey: true, ...);

Basically, I want to expose a native feature of the platform directly.

I assumed it would be best to have a distinct issue for each feature proposal, rather than a distinct issue for each use case, since some feature proposals will solve a broad range of use cases. But I'm fine if you want to handle everything on the other issue. I'll add a comment there.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-05
Star Count 145512
Watcher Count 3569
Fork Count 23398
Issue Count 11205

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
The pop-up window render doesn't disappear 0 2021-09-14 2022-09-10
`stats`: calculate outer upper fence and outer lower fence 0 2022-06-07 2022-07-05
exec argument hide_phantoms_only no longer works in ST4 1 2021-06-04 2022-07-20
docs.sublimetext.info is unavailable 1 2021-04-25 2022-10-01
hadoop_datanode_metrics 未定义诶 1 2020-08-26 2022-08-15
Warning: KS2.5 default output directory same as working directory and may delete primary Open-Ephys .npy files. 2 2020-11-23 2022-09-09
Kilosort GPU crashing on linux before final run (linux 18.04, Nvidia 410.78) 5 2019-01-18 2022-09-09
Performance: Page Zoom, integrate with page canvas provider 2 2022-03-07 2022-08-12
iOS purchase button takes long time to load on Release Product 15 2021-11-22 2022-10-03
Question: A step by step guide how to compile ISO 2 2021-11-23 2022-10-04
gene has to contain regulator? 4 2021-05-19 2022-07-08
Why pyObject is declared as AutoCloseable? 3 2022-06-19 2022-08-29
empty space between frame and pcb 2 2021-04-20 2022-07-19
COOL Onboarding 6 2021-12-03 2022-01-02
Did not expect server HTML to contain a <script> in <html>. 2 2021-12-21 2022-08-17
Postinst script syntax error 9 2016-10-18 2022-09-17
Fix: Terraform - Re-applying private cloud attempts re-creation 1 2022-04-13 2022-09-28
Feature Requests : Detect RDS procedure mysql.rds_kill and use it when MariaDB /MySQL RDS is set up as backend 0 2022-09-28 2022-09-24
C++ or Python? Which language can make my code faster? 3 2018-09-02 2022-09-27
使用代理不能同步配置 11 2021-09-07 2022-01-19
Fails to open due to x11 issue. 7 2021-10-05 2022-10-04
Remove support for EF Core 5 before 7 RTM 0 2022-10-01 2022-10-03
Mcmmo plugin not enabling at server start-up 7 2021-11-04 2022-08-17
ESM / CJS syntax detection 2 2021-10-21 2022-10-02
Vxrail plugin pack (REST api) 4 2022-04-06 2022-09-20
[master] New Install - Error: Call to undefined function 10 2022-07-25 2022-09-30
[kube-prometheus-stack] CRDs are not being installed by chart 15 2021-12-06 2022-09-13
Kubernetes cache-stack documentation update 4 2022-02-20 2022-08-18
Plugin Id is not available to Plugin in CMSPlugin.php 5 2022-06-19 2022-09-02
Create a SECURITY_CONTACTS file. 3 2021-12-07 2022-10-04
the video in https://www.bilibili.com/ usually invalid 1 2021-08-11 2022-09-04
`+layout.server.ts` is called on every client side navigation to nested routes 2 2022-08-18 2022-10-04
[GodotPhysics] `move_and_slide()` moves objects in reverse when something else hits them 1 2022-09-13 2022-09-15
Strings passed to c should not use `&str` 5 2021-06-10 2022-08-16
Pentest reports outdated JavaScript libraries used for angularjs version 1.2.26 2 2021-09-16 2022-09-21
Firefox crash 1 2021-03-29 2022-01-22
Move core packages to a single repository 4 2018-07-06 2022-09-16
create view v_generate_tbl_ddl error 1 2021-02-11 2022-09-04
Adding a View to a ScrollView 0 2021-12-03 2022-10-04
V3.0-stable, Maximum number of communities 1 2022-05-06 2022-10-03
x/vulndb: potential Go vuln in github.com/opencontainers/distribution-spec: CVE-2021-41190 1 2022-01-07 2022-07-05
`gettext.GNUTranslations.__init__`’s argument has an incorrect type 2 2022-04-15 2022-08-04
Allow applying SDK log mode in shared config 0 2021-11-17 2022-10-04
Inconsistent connection update behavior, potentially causing client_secret deletion 15 2022-02-23 2022-09-13
No link available to view all messages page 4 2020-11-26 2022-09-29
프레그 먼트에서 onCreateView 에 SuperCall 에러가 있습니다. 1 2021-08-02 2022-09-18
Is there sorter documentation? 1 2019-10-29 2022-09-12
Terraform apply fails with message 'registry.terraform.io/hashicorp/local: there is no package for registry.terraform.io/hashicorp/local 2.1.0 cached in .terraform/providers' 8 2021-12-09 2022-09-30
Map Multibinding in the library module 2 2021-06-09 2022-09-19
Remove Picture/Scene toImageSync from 3.3 beta 10 2022-07-26 2022-09-29