Skip to content

Add enableSuggestions flag to TextField and TextFormField#42550

Merged
justinmc merged 7 commits intoflutter:masterfrom
justinmc:no-suggestions
Oct 28, 2019
Merged

Add enableSuggestions flag to TextField and TextFormField#42550
justinmc merged 7 commits intoflutter:masterfrom
justinmc:no-suggestions

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Oct 11, 2019

Description

Currently there is no direct control over the TYPE_TEXT_FLAG_NO_SUGGESTIONS flag in Android. This PR adds a enableSuggestions flag to all types of text fields to control this Android flag.

Related Issues

Closes #22828
Closes #41758
Depends on engine PR: flutter/engine#13099

Tests

Testing that the property is set and that it goes to the engine correctly. I don't think there's a more thorough way to test that.

@justinmc justinmc added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. f: cupertino flutter/packages/flutter/cupertino repository work in progress; do not review labels Oct 11, 2019
@justinmc justinmc self-assigned this Oct 11, 2019
@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Oct 11, 2019
@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@blindjoedeath
Copy link

Dude, you are doing the great job!!!! God bless your soul..
This is really important for my recent project.

@justinmc
Copy link
Contributor Author

No problem! 🎉 I'm trying to figure out some tests for this and then it should be ready for code review.

@justinmc justinmc changed the title WIP Add noSuggestions flag to TextField and TextFormField Add noSuggestions flag to TextField and TextFormField Oct 11, 2019
@justinmc justinmc requested a review from HansMuller October 11, 2019 21:40
@justinmc
Copy link
Contributor Author

Is noSuggestions a good name? Just mirroring the Android name (and the negative). We could also go with something like keyboardSuggestions or allowKeyboardSuggestions and invert it. I'm not strongly opinionated.

@jonahwilliams
Copy link
Contributor

I think it would be better to state it in the positive, rather than be consistent with a (IMO) bad API.

@justinmc
Copy link
Contributor Author

Thanks @jonahwilliams, I'm on board with that. I'll plan to change it to enableKeyboardSuggestions unless anyone else disagrees?

@blindjoedeath
Copy link

@justinmc How is your work going? Is it possible to get your commits in near future?:)

@justinmc
Copy link
Contributor Author

Sorry for the delay! I'm changing the name to enableSuggestions. The engine PR should be able to be merged in the next few hours, and then this PR can follow.

@HansMuller HansMuller changed the title Add noSuggestions flag to TextField and TextFormField Add enableSuggestions flag to TextField and TextFormField Oct 21, 2019
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

final bool autocorrect;

/// {@template flutter.services.textInput.enableSuggestions}
/// Whether to hide suggestions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we provide a brief explanation of what "suggestions" actually are?

/// {@template flutter.services.textInput.enableSuggestions}
/// Whether to hide suggestions.
///
/// This flag only affects Android. On iOS, suggestions are tied directly to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe link "Android" to the native doc that describes the feature we depend on.

@SiyrisSoul
Copy link
Contributor

What's the status on this?

@justinmc
Copy link
Contributor Author

Just waiting for the build to be green so I can merge this.

I just verified with the engine on master that this branch works and passes the flag correctly, so everything is good to go.

@justinmc justinmc merged commit 6e888da into flutter:master Oct 28, 2019
@justinmc justinmc deleted the no-suggestions branch October 28, 2019 22:31
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
)

This flag controls Android's keyboard suggestions on/off
@YaseenAbdullah
Copy link

YaseenAbdullah commented May 7, 2020

Capture4
i still have this issue why? isn't it fixed?

@justinmc
Copy link
Contributor Author

justinmc commented May 7, 2020

What version are you using? I think this is in v1.16.3 and above.

@YaseenAbdullah
Copy link

What version are you using? I think this is in v1.16.3 and above.

Latest version 1.17.0, i updated it last night

@justinmc
Copy link
Contributor Author

justinmc commented May 7, 2020

Hmm thanks for checking. Does the flag TYPE_TEXT_FLAG_NO_SUGGESTIONS solve your problem in native Android? It looks like you're using the default Gboard keyboard, and I was seeing it ignore that flag even in a native app when I tested this.

@YaseenAbdullah
Copy link

Hmm thanks for checking. Does the flag TYPE_TEXT_FLAG_NO_SUGGESTIONS solve your problem in native Android? It looks like you're using the default Gboard keyboard, and I was seeing it ignore that flag even in a native app when I tested this.

I didn't tested it in native android but i use SwiftKey in my physical device it's the same

@YaseenAbdullah
Copy link

YaseenAbdullah commented May 7, 2020

any hint how to make it work? I really need it in my project

UPDATE: used keyboardType: TextInputType.visiblePassword for now it does what I want..

@justinmc
Copy link
Contributor Author

justinmc commented May 7, 2020

See this comment: #22828 (comment)

If your problem is the same as that, then it might not be possible to achieve even on native Android. If Flutter is missing something that native has we can look into adding support, though.

@NickalasB
Copy link

NickalasB commented Feb 4, 2021

FWIW setting enableSuggestions:false doesn't work for me either. I'm using Pixel 3/Android 11

[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H114 darwin-x64, locale en-US)

This issue #22828 outlines the issue but was closed after this was merged

RE this 👇 :

UPDATE: used keyboardType: TextInputType.visiblePassword for now it does what I want..

That DOES work but on Android it disables the microphone... which is undesirable

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextField autocorrect=false bug TextField: "autocorrect: false" still shows suggestions in keyboard

9 participants