-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Migration guide for deprecating textScaleFactor in favor of TextScaler
#8903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration guide for deprecating textScaleFactor in favor of TextScaler
#8903
Conversation
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is still in draft, but I have feedback anyway. :)
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
|
Oh, this PR is currently breaking the build because these two links are missing: Finally, don't forget to add this page to the index! :D |
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
d85b467 to
1b86a28
Compare
1b86a28 to
46d6ce3
Compare
|
I think this is ready for review now that the framework PR is LGTM'd. One thing that I might not have conveyed clearly in this migration guide is that the framework PR in fact doesn't add Android 14 non-linear text scaling support (it will be added in a follow up PR). So if people want to test their apps against Android 14 nonlinear text scaling then they would have to wait for a different PR to land. Do you have any suggestions on how I should add that information to the migration guide? |
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
| | `SelectableText.rich({ double? TextScaleFactor = 1.0 })` constructor argument | 'textScaleFactor' is deprecated and shouldn't be used. | | ||
| | `SelectableText.textScaleFactor` getter | 'textScaleFactor' is deprecated and shouldn't be used. | | ||
|
|
||
| ## Migration guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since non-linear text scaling isn't actually implemented I would focus the guide just on the change from textScaleFactor to textScaler and what app developers need to do to adapt to that. (In the context section it is good to mention the non-linear scaling as motivation for the change, but we shouldn't leave the impression that that's already implemented and shouldn't ask people to test it)
| consider replacing `textScaleFactor` with `TextScaler.textScaleFactor` first. The | ||
| `TextScaler.textScaleFactor` getter was added for backward compatibility during | ||
| the migration process and is expected to have a longer lifetime than other | ||
| `textScaleFactor` deprecations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should promise a longer deprecation period. The regular policy applies here (for now).
| // For now, implementers can still access the `textScaleFactor`. | ||
| // scalar via textScaler.textScaleFactor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's focus the guide on what the right way to migrate is, e.g. how should textScaler be used correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this guide shouldn't mention textScaler.textScaleFactor at all since that is not the right way to migrate your code long-term. If necessary, we can at the very end mention it for completeness, but it I wouldn't focus the guide this much around it. It's not a long-term solution and asking people to migrate to something that is already deprecated is somewhat frustrating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add a section for apps that don't target Android 14 and tell them to add an extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that realistic for an app to not target Android 14? That'll have to happen sooner or later, no? I don't think I would spend too much time on how to do the thing we don't want developers to do...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true for desktop-only apps or web-only apps I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, ok. The long-term goal is that TextScaler is the only text scaling mechanism in Flutter, though. And I don't think we should (pretend to) support anything else. The migration guide should show people how to migrate to TextScaler, which is the API we want people to use and the only one we will actually support in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll save that for the migration guide for nonlinear text scaling
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
textScaleFactor in favor of TextScaler
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some minor updates but, overall, this looks good. @goderbauer, it seems like your issues are addressed? Is this lgtm for you?
|
|
||
| ## Timeline | ||
|
|
||
| Landed in version: xxx<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't land this PR until the "Landed in" field is filled out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to land the PR probably early next week.
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
||
| The `scale` method should be used to scale font sizes in lieu of `textScaleFactor`. | ||
| The `textScaleFactor` getter provides an estimated `textScaleFactor` value, it | ||
| is for backward compatibility purposes and is already marked as deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add to be very explicit: It will be removed in a future version of Flutter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was discouraged to use future tenses in migration guides? Not sure how best to phrase this @sfshaza2 any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That use is fine, @LongCatIsLooong.
src/release/breaking-changes/android-14-nonlinear-text-scaling.md
Outdated
Show resolved
Hide resolved
| ``` | ||
|
|
||
|
|
||
| If the API that provides `textScaleFactor` hasn't been migrated, consider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically move this before the "bad" migration advice above. (Or better: just remove that "bad" advice)
|
OK! Just ping me. |
|
Hi @sfshaza2 the PR is now merged. I added a section at the end of the migration guide to explain how to opt-out of non-linear scaling, since some customers wanted to QA the migration and slowly roll out. |
|
|
||
| ## Timeline | ||
|
|
||
| Landed in version: xxx<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fill in this field?
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
|
The build failed. Do you use API that's not yet available? If so, can you use the master channel API link? |
|
Reran the test and it's passing now. |
Corresponds to the framework PR: flutter/flutter#128522
Presubmit checklist