[ios] Add opt-in inline prediction text input support#183650
Conversation
Expose inline prediction configuration through Flutter text fields so apps can explicitly control iOS 17 inline predictive text behavior and ensure the engine handles attributed marked text correctly. Made-with: Cursor
There was a problem hiding this comment.
Code Review
This pull request introduces an opt-in feature for inline predictive text on iOS 17 by adding an enableInlinePrediction property to TextInputConfiguration and various text input widgets (EditableText, TextField, CupertinoTextField). The changes propagate this setting down to the iOS engine, which correctly configures the native UITextInput and handles attributed marked text. The implementation is thorough, spanning the framework and engine, and is accompanied by comprehensive tests at each layer, ensuring the new functionality is robust and the default behavior is preserved. The code is clean and follows existing conventions.
|
For reviewers, you can find the previous PR here: #182728. |
There was a problem hiding this comment.
Thanks for the wonderful contribution, this looks good to me!
Please also get approval from @LongCatIsLooong or @hellohuanlin before merging this.
|
@LongCatIsLooong & @hellohuanlin can you please review this PR, thank you |
Co-authored-by: Loïc Sharma <[email protected]>
|
@loic-sharma can you please assist with merging this pull request, i believe autosubmit and CICD label needs to be added here. |
|
@hellohuanlin can you also review the PR - I believe approval from all the reviewers is required for Google Testing workflow to get triggered |
|
@nikb7 Hm it seems something went wrong with Google tests. I restarted them manually. I'll loop back in a bit! |
flutter/flutter@3d69471...0f401ee 2026-04-02 [email protected] Remove isSizedToContent from _window_linux.dart. (flutter/flutter#184506) 2026-04-02 [email protected] Windows: Get graphics adapter from engine instead of view (flutter/flutter#184479) 2026-04-02 [email protected] Reduce number of mallocs in FFI call (flutter/flutter#184166) 2026-04-02 [email protected] Handle events without a device (flutter/flutter#184163) 2026-04-02 [email protected] Implement tooltip windows on Linux (flutter/flutter#182348) 2026-04-02 [email protected] Roll Skia from bdeebacf23c8 to bb9fd8653739 (4 revisions) (flutter/flutter#184494) 2026-04-02 [email protected] Implement popup windows for macOS (flutter/flutter#182371) 2026-04-02 [email protected] Roll Fuchsia Linux SDK from fV-JIWUt4FQGeDtEe... to BFLjk6Uwd0gs_Hkdk... (flutter/flutter#184492) 2026-04-02 [email protected] Add await or ignore to future-returning methods defined in Dart SDK (flutter/flutter#184229) 2026-04-02 [email protected] Roll Dart SDK from 043a2bfd56ff to d84bdfeb45eb (2 revisions) (flutter/flutter#184487) 2026-04-01 [email protected] Roll Skia from c2363c39c283 to bdeebacf23c8 (9 revisions) (flutter/flutter#184480) 2026-04-01 [email protected] Remove sliver_test_utils cross-import from sliver_app_bar_test (flutter/flutter#184193) 2026-04-01 [email protected] Improve error message when `dart-define` content are not `base64 encoded` and add more test cases (flutter/flutter#184219) 2026-04-01 [email protected] Replace usages of `MediaQuery.of(context).property` with `MediaQuery.propertyOf(context)` (flutter/flutter#184211) 2026-04-01 [email protected] [ios] Add opt-in inline prediction text input support (flutter/flutter#183650) 2026-04-01 [email protected] [fix-forward] fix build_android_host_app_with_module_source integration test (flutter/flutter#184466) 2026-04-01 [email protected] Update style guide (flutter/flutter#184478) 2026-04-01 [email protected] Roll Packages from b04f3e5 to b3fcf14 (3 revisions) (flutter/flutter#184474) 2026-04-01 [email protected] Warn about slow SwiftPM downloads and centralize SwiftPM cache (flutter/flutter#183747) 2026-04-01 [email protected] Inject FlutterFramework dependency in iOS Add2App swift packages (flutter/flutter#184365) 2026-04-01 [email protected] Prepare for skills adoption (flutter/flutter#184129) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Expose inline prediction configuration through Flutter text fields so apps can explicitly control iOS 17 inline predictive text behavior and ensure the engine handles attributed marked text correctly. This PR adds an `enableInlinePrediction` option to `TextInputConfiguration`, `EditableText`, `TextField`, and `CupertinoTextField`, and forwards that setting to the iOS text input plugin. On the engine side, the iOS text input implementation now: - maps `enableInlinePrediction` to `UITextInlinePredictionType` on iOS 17+ - defaults inline prediction to disabled unless the framework explicitly enables it - handles `setAttributedMarkedText:selectedRange:` by forwarding the plain string to the existing marked text flow so inline predictive text updates are processed correctly This keeps the feature opt-in, preserves existing behavior by default, and gives apps explicit control over inline predictive text on supported iOS versions. Fixes: flutter#135221 Previous PR: flutter#182728 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines --------- Co-authored-by: Loïc Sharma <[email protected]>
Expose inline prediction configuration through Flutter text fields so apps can explicitly control iOS 17 inline predictive text behavior and ensure the engine handles attributed marked text correctly.
This PR adds an
enableInlinePredictionoption toTextInputConfiguration,EditableText,TextField, andCupertinoTextField, and forwards that setting to the iOS text input plugin.On the engine side, the iOS text input implementation now:
enableInlinePredictiontoUITextInlinePredictionTypeon iOS 17+setAttributedMarkedText:selectedRange:by forwarding the plain string to the existing marked text flow so inline predictive text updates are processed correctlyThis keeps the feature opt-in, preserves existing behavior by default, and gives apps explicit control over inline predictive text on supported iOS versions.
Fixes: #135221
Previous PR: #182728
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.