flutter/dev/benchmarks/macrobenchmarks/lib/src
LongCatIsLooong b2e22d3558
Replaces textScaleFactor with TextScaler (#128522)
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: c47fd38dca/super_editor/lib/src/infrastructure/super_textfield/desktop/desktop_textfield.dart (L1903-L1905)|
| `TextPainter({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
| `TextPainter.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |
| `TextPainter.computeWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | |
| `TextPainter.computeMaxIntrinsicWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | |

### `Rendering` Library

| Affected API | State of `textScaleFactor` | Comment | 
| --- | --- | --- |
| `RenderEditable({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
| `RenderEditable.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |
| `RenderParagraph({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
| `RenderParagraph.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |

### `Widgets` Library

| Affected API | State of `textScaleFactor` | Comment | 
| --- | --- | --- |
| `MediaQueryData({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | cd7b93532e/packages/flutter_markdown/test/text_scale_factor_test.dart (LL39C21-L39C35) |
| `MediaQueryData.textScaleFactor` getter | Deprecated | |
| `MediaQueryData.copyWith({ double? TextScaleFactor })` argument | Deprecated | |
| `MediaQuery.maybeTextScaleFactorOf(BuildContext context)` static method | Deprecated | No Flutter Fix, not expressible yet  |
| `MediaQuery.textScaleFactorOf(BuildContext context)` static method | **To Be Deprecated** | cd7b93532e/packages/flutter_markdown/lib/src/_functions_io.dart (L68-L70), No Flutter Fix, not expressible yet |
| `RichText({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | cd7b93532e/packages/flutter_markdown/lib/src/builder.dart (L829-L843) |
| `RichText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away|
| `Text({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | 914d120da1/packages/rfw/lib/src/flutter/core_widgets.dart (L647) , No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
| `Text.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
| `Text.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away |
| `EditableText({ double? TextScaleFactor = 1.0 })` constructor argument | Deprecated | No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
| `EditableText.textScaleFactor` getter | Deprecated | |

### `Material` Library

| Affected API | State of `textScaleFactor` | Comment | 
| --- | --- | --- |
| `SelectableText({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | cd7b93532e/packages/flutter_markdown/lib/src/builder.dart (L829-L843), No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
| `SelectableText.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
| `SelectableText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away |

A lot of material widgets (`Slider`, `RangeSlider`, `TimePicker`, and different types of buttons) also change their layout based on `textScaleFactor`. These need to be handled in a case-by-case fashion and will be migrated in follow-up PRs.
2023-07-17 17:56:07 +00:00
..
web Replaces textScaleFactor with TextScaler (#128522) 2023-07-17 17:56:07 +00:00
animated_blur_backdrop_filter.dart [devicelab] add regular old blur benchmark (#123879) 2023-03-31 20:54:51 +00:00
animated_complex_image_filtered.dart Fix typos (#121171) 2023-02-23 19:43:21 +00:00
animated_complex_opacity.dart Fix typos (#121171) 2023-02-23 19:43:21 +00:00
animated_image.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
animated_placeholder.dart Add more flexible image API (#118966) 2023-01-25 21:21:28 -08:00
animation_with_microtasks.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
backdrop_filter.dart Enable use_colored_box lint (#117370) 2022-12-20 14:09:55 -08:00
clipper_cache.dart Remove single window assumption from macrobenchmark (#119368) 2023-01-27 20:42:42 +00:00
color_filter_and_fade.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
color_filter_cache.dart Enable unnecessary_import (#101600) 2022-04-08 12:56:45 -07:00
color_filter_with_unstable_child.dart Added benchmark for early removal of unused raster cache entris mecha… (#107918) 2022-07-20 19:13:06 +00:00
cubic_bezier.dart Make Flex,Row,Column const for real (#119673) 2023-02-02 19:33:57 +00:00
cull_opacity.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
draw_points.dart [web] ui.platformViewRegistry => ui_web.platformViewRegistry (#127493) 2023-05-24 23:31:28 +00:00
filtered_child_animation.dart Remove 1745 decorative breaks (#123259) 2023-03-22 21:12:22 +00:00
fullscreen_textfield.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
gradient_perf.dart Migrate remaining files to super parameters (#101919) 2022-04-14 12:04:07 -07:00
heavy_grid_view.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
large_image_changer.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
large_images.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
list_text_layout.dart Add a macrobenchmark for laying out text in a list (#104736) 2022-05-26 15:25:10 -07:00
multi_widget_construction.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
opacity_peephole.dart Update collection-fors to prefer final (as per updated prefer_final_in_for_each) (#127511) 2023-05-26 23:34:36 +00:00
picture_cache_complexity_scoring.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
picture_cache.dart add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
post_backdrop_filter.dart Enable use_colored_box lint (#117370) 2022-12-20 14:09:55 -08:00
raster_cache_use_memory.dart Add benchmark case for RasterCache (#103338) 2022-06-29 23:54:10 +00:00
shader_mask_cache.dart Enable unnecessary_import (#101600) 2022-04-08 12:56:45 -07:00
simple_animation.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
simple_scroll.dart Prepare more of dev for use_super_parameters (#101073) 2022-03-30 14:05:05 -07:00
sliders.dart Add Sliders to macrobenchmarks (#125296) 2023-04-24 23:25:28 +00:00
stack_size.dart Make Flex,Row,Column const for real (#119673) 2023-02-02 19:33:57 +00:00
text.dart Make Flex,Row,Column const for real (#119673) 2023-02-02 19:33:57 +00:00