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..2be4cba06a --- /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 07ce977d3c..4b4378e7b3 100644 --- a/src/content/release/breaking-changes/index.md +++ b/src/content/release/breaking-changes/index.md @@ -40,6 +40,7 @@ They're sorted by release and listed in alphabetical order: * [`FontWeight` also controls the weight attribute of variable fonts][] * [Deprecate `containsSemantics` in favor of `isSemantics`][] * [Deprecate `findChildIndexCallback` in favor of `findItemIndexCallback` in `ListView` and `SliverList` separated constructors][] +* [Deprecate `TextInputConnection.setStyle`][] * [Migrating Flutter Android app to Android Gradle Plugin 9.0.0][] * [Material 3 tokens update][] * [Page transition builders reorganization][] @@ -51,6 +52,7 @@ They're sorted by release and listed in alphabetical order: [`FontWeight` also controls the weight attribute of variable fonts]: /release/breaking-changes/font-weight-variation [Deprecate `containsSemantics` in favor of `isSemantics`]: /release/breaking-changes/deprecate-contains-semantics [Deprecate `findChildIndexCallback` in favor of `findItemIndexCallback` in `ListView` and `SliverList` separated constructors]: /release/breaking-changes/separated-builder-find-child-index-callback +[Deprecate `TextInputConnection.setStyle`]: /release/breaking-changes/deprecate-text-input-connection-set-style [Migrating Flutter Android app to Android Gradle Plugin 9.0.0]: /release/breaking-changes/migrate-to-agp-9 [Material 3 tokens update]: /release/breaking-changes/material-color-utilities