diff --git a/src/content/release/breaking-changes/deprecate-text-input-connection-set-style.md b/src/content/release/breaking-changes/deprecate-text-input-connection-set-style.md new file mode 100644 index 0000000000..c462be190c --- /dev/null +++ b/src/content/release/breaking-changes/deprecate-text-input-connection-set-style.md @@ -0,0 +1,75 @@ +--- +title: Deprecate `TextInputConnection.setStyle` +description: >- + The `TextInputConnection.setStyle` method has been deprecated in favor + of the `TextInputConnection.updateStyle` method. +--- + +{% render "docs/breaking-changes.md" %} + +## Summary + +`TextInputConnection.setStyle` is deprecated in favor of +`TextInputConnection.updateStyle`, which supports synchronizing +`letterSpacing`, `wordSpacing`, and `lineHeight` to the engine. + +## Context + +The previous `setStyle` method did not support `letterSpacing`, `wordSpacing`, +or `lineHeight`. This caused visual misalignment of the selection highlight +and IME caret when these properties were used. + +The replacement `updateStyle` method (via `TextInputStyle`) supports these +properties, ensuring the system input is synchronized with the rendered text. + +## Migration guide + +Authors of custom text input clients should replace calls to +`TextInputConnection.setStyle` with `TextInputConnection.updateStyle`. + +### Code before migration: + +```dart +connection.setStyle( + fontFamily: 'Roboto', + fontSize: 14.0, + fontWeight: FontWeight.normal, + textDirection: TextDirection.ltr, + textAlign: TextAlign.start, +); +``` + +### Code after migration: + +```dart +connection.updateStyle( + TextInputStyle( + fontFamily: 'Roboto', + fontSize: 14.0, + fontWeight: FontWeight.normal, + textDirection: TextDirection.ltr, + textAlign: TextAlign.start, + letterSpacing: 1.2, + wordSpacing: 1.0, + lineHeight: 1.5, + ), +); +``` + +## Timeline + +Landed in version: TBD
+In stable release: Not yet + +## References + +Relevant PR: + +* [PR 180436][] + +Relevant issues: + +* [Issue 161592][] + +[PR 180436]: {{site.repo.flutter}}/pull/180436 +[Issue 161592]: {{site.repo.flutter}}/issues/161592 diff --git a/src/content/release/breaking-changes/index.md b/src/content/release/breaking-changes/index.md index ad3d119ebc..80ebcc3577 100644 --- a/src/content/release/breaking-changes/index.md +++ b/src/content/release/breaking-changes/index.md @@ -38,12 +38,14 @@ They're sorted by release and listed in alphabetical order: * [Deprecate `onReorder` callback][] * [Deprecated `cacheExtent` and `cacheExtentStyle`][] +* [Deprecate `TextInputConnection.setStyle`][] * [ListTile throws exception when wrapped in a colored widget][] * [Migrating Flutter Android app to Android Gradle Plugin 9.0.0][] * [Page transition builders reorganization][] [Deprecate `onReorder` callback]: /release/breaking-changes/deprecate-onreorder-callback [Deprecated `cacheExtent` and `cacheExtentStyle`]: /release/breaking-changes/scroll-cache-extent +[Deprecate `TextInputConnection.setStyle`]: /release/breaking-changes/deprecate-text-input-connection-set-style [ListTile throws exception when wrapped in a colored widget]: /release/breaking-changes/list-tile-color-warning [Migrating Flutter Android app to Android Gradle Plugin 9.0.0]: /release/breaking-changes/migrate-to-agp-9 [Page transition builders reorganization]: /release/breaking-changes/decouple-page-transition-builders