mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() Deprecate `textScaleFactor` in favor of `textScaler`, in preparation for Android 14 [Non-linear font scaling to 200%](https://developer.android.com/about/versions/14/features#non-linear-font-scaling). The `TextScaler` class can be moved to `dart:ui` in the future, if we decide to use the Android platform API or AndroidX to get the scaling curve instead of hard coding the curve in the framework. I haven't put the Flutter version in the deprecation message so the analyzer checks are failing. Will do so after I finish the migration guide. **Why `TextScaler.textScaleFactor`** The author of a `TextScaler` subclass should provide a fallback `textScaleFactor`. By making `TextScaler` also contain the `textScaleFactor` information it also makes it easier to migrate: if a widget overrides `MediaQueryData.textScaler` in the tree, for unmigrated widgets in the subtree it would also have to override `MediaQueryData.textScaleFactor`, and that makes it difficult to remove `MediaQueryData.textScaleFactor` in the future. ## A full list of affected APIs in this PR Deprecated: The method/getter/setter/argument is annotated with a `@Deprecated()` annotation in this PR, and the caller should replace it with `textScaler` instead. Unless otherwise specified there will be a Flutter fix available to help with migration but it's still recommended to migrate case-by-case. **Replaced**: The method this `textScaleFactor` argument belongs to is rarely called directly by user code and is not overridden by any of the registered custom tests, so the argument is directly replaced by `TextScaler`. **To Be Deprecated**: The method/getter/setter/argument can't be deprecated in this PR because a registered customer test depends on it and a Flutter fix isn't available (or the test was run without applying flutter fixes first). This method/getter/setter/argument will be deprecated in a followup PR once the registered test is migrated. ### `Painting` Library | Affected API | State of `textScaleFactor` | Comment | | --- | --- | --- | | `InlineSpan.build({ double textScaleFactor = 1.0 })` argument | **Replaced** | | | `TextStyle.getParagraphStyle({ double TextScaleFactor = 1.0 })` argument | **Replaced** | | | `TextStyle.getTextStyle({ double TextScaleFactor = 1.0 })` argument| Deprecated | Can't replace: |
||
---|---|---|
.. | ||
action_chip_template.dart | ||
app_bar_template.dart | ||
badge_template.dart | ||
banner_template.dart | ||
bottom_app_bar_template.dart | ||
bottom_sheet_template.dart | ||
button_template.dart | ||
card_template.dart | ||
checkbox_template.dart | ||
chip_template.dart | ||
color_scheme_template.dart | ||
date_picker_template.dart | ||
dialog_template.dart | ||
divider_template.dart | ||
drawer_template.dart | ||
expansion_tile_template.dart | ||
fab_template.dart | ||
filter_chip_template.dart | ||
icon_button_template.dart | ||
input_chip_template.dart | ||
input_decorator_template.dart | ||
list_tile_template.dart | ||
menu_template.dart | ||
navigation_bar_template.dart | ||
navigation_drawer_template.dart | ||
navigation_rail_template.dart | ||
popup_menu_template.dart | ||
progress_indicator_template.dart | ||
radio_template.dart | ||
search_bar_template.dart | ||
search_view_template.dart | ||
segmented_button_template.dart | ||
slider_template.dart | ||
snackbar_template.dart | ||
surface_tint.dart | ||
switch_template.dart | ||
tabs_template.dart | ||
template.dart | ||
text_field_template.dart | ||
time_picker_template.dart | ||
token_logger.dart | ||
typography_template.dart |