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: |
||
---|---|---|
.. | ||
web | ||
animated_blur_backdrop_filter.dart | ||
animated_complex_image_filtered.dart | ||
animated_complex_opacity.dart | ||
animated_image.dart | ||
animated_placeholder.dart | ||
animation_with_microtasks.dart | ||
backdrop_filter.dart | ||
clipper_cache.dart | ||
color_filter_and_fade.dart | ||
color_filter_cache.dart | ||
color_filter_with_unstable_child.dart | ||
cubic_bezier.dart | ||
cull_opacity.dart | ||
draw_points.dart | ||
filtered_child_animation.dart | ||
fullscreen_textfield.dart | ||
gradient_perf.dart | ||
heavy_grid_view.dart | ||
large_image_changer.dart | ||
large_images.dart | ||
list_text_layout.dart | ||
multi_widget_construction.dart | ||
opacity_peephole.dart | ||
picture_cache_complexity_scoring.dart | ||
picture_cache.dart | ||
post_backdrop_filter.dart | ||
raster_cache_use_memory.dart | ||
shader_mask_cache.dart | ||
simple_animation.dart | ||
simple_scroll.dart | ||
sliders.dart | ||
stack_size.dart | ||
text.dart |