-
Notifications
You must be signed in to change notification settings - Fork 29.7k
docs: Update doc for scale behaviour of floating label #151835
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
docs: Update doc for scale behaviour of floating label #151835
Conversation
| /// [InputDecoration.errorStyle] color or [ColorScheme.error]. | ||
| /// | ||
| /// When [label] is shown above the input field, it is scaled down | ||
| /// to [_kFinalLabelScale]. So, any given font size needs to be changed |
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.
Please don't reference private symbols in doc comments
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.
Hey @goderbauer, I want to show the scale number, should I directly add 0.75 rather than using private variable. Or any other approach ?
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.
Putting 0.75 in the docs is alright, since otherwise folks won't be able to look up the private value without visiting the source code. :)
e8dfa9b to
08e2455
Compare
08e2455 to
18892ff
Compare
|
Hey @rkishan516 thanks for the update! It looks like the |
5d5b8c8 to
315ea7a
Compare
@Piinks If I am not wrong, I can access |
|
It is because that doc is also being referenced in other places as a template. It needs the full reference that includes the class name. |
7c2bfab to
9c8d09f
Compare
| /// to 0.75. So, any given font size needs to be changed | ||
| /// accordingly that it will be scaling down at the end. |
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.
@rkishan516 can you help clarify this last sentence? I am not sure what font size you are referring to and how it affects the scaling down in response to focus.
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.
Yaa, sure. For any given floatingLabelStyle when we are in focus, we do transform operation to scale down by 75%.
Meaning :- If you are giving fontSize as 24, What you will see is fontSize 18. So, if we want to see fontSize 24, then we should give fontSize as 32.
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.
Just FYI, We are not scaling down fontSize rather we are scaling down whole box where its rendering label. So, actual visible font size will be always 75% of what is given.
| /// When [InputDecoration.label] is shown above the input field, it is scaled down | ||
| /// to 0.75. So, any given font size needs to be changed | ||
| /// accordingly that it will be scaling down at the end. |
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.
| /// When [InputDecoration.label] is shown above the input field, it is scaled down | |
| /// to 0.75. So, any given font size needs to be changed | |
| /// accordingly that it will be scaling down at the end. | |
| /// When the input field receives focus, the font size of [InputDecoration.label] is | |
| /// scaled down by 75%. |
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.
What do you think @rkishan516?
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.
@Piinks We only use floatingLabelStyle when field has focus. I don't know, we should mention that or not. Also, we should clearly tell user that it's not font size changing its label itself scaling down by 75%.
/// The [InputDecoration.label] is scaled down to 75% when input field receives focus.
/// Adjust the font size accordingly to ensure it appears as intended after scaling.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.
May be we don't need
/// Adjust the font size accordingly to ensure it appears as intended after scaling.But to be on safe side, I want user to know that he should change fontSize knowing this fact.
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.
They may not need to change the font size if the default behavior is what they want. This seems like for of a 'for your information' doc, rather than a call to action. If it were a bug, we would just fix the font scaling for them. :)
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.
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.
Ok! From the original issue:
Nothing in the official docs even mentions that this would happen.
I think it is fine to just mention the behavior, since it is working as expected. Users do not necessarily need to make any changes, which is why I suggested removing the recommendation.
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.
Sure, I have done the change.
026e083 to
b793d2f
Compare
b793d2f to
737fb06
Compare
Piinks
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!
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.
Well, I might. not be a blessed reviewer over here, but this comment text looks great to me!
flutter/flutter@e7da16d...b8f89f7 2024-08-21 [email protected] docs: Update doc for scale behaviour of floating label (flutter/flutter#151835) 2024-08-21 [email protected] Disable Dropdown menu search during keyboard navigation (flutter/flutter#152378) 2024-08-21 [email protected] Add a `bin/flutter-dev` script, for running the `flutter` command-line tool from source (flutter/flutter#153599) 2024-08-21 [email protected] Roll Packages from 4d2d2e3 to 4e5d47e (6 revisions) (flutter/flutter#153848) 2024-08-21 [email protected] Remove unnecessary breaks in default clauses of switch statements (flutter/flutter#153843) 2024-08-21 [email protected] Create Postmortem-Platform-View-android-14-regression (flutter/flutter#149201) 2024-08-21 [email protected] Roll pub packages (flutter/flutter#153838) 2024-08-21 [email protected] Roll pub packages (flutter/flutter#153833) 2024-08-21 [email protected] Add tests for `SingleChildScrollView` examples (flutter/flutter#153548) 2024-08-21 [email protected] Roll Flutter Engine from b1220aa0ebf2 to b94e0097035d (3 revisions) (flutter/flutter#153817) 2024-08-21 [email protected] Roll Flutter Engine from aa1422391cf6 to b1220aa0ebf2 (1 revision) (flutter/flutter#153810) 2024-08-21 [email protected] Roll Flutter Engine from a6508d6557dc to aa1422391cf6 (2 revisions) (flutter/flutter#153808) 2024-08-21 [email protected] Roll Flutter Engine from 5cbf96d0a80f to a6508d6557dc (1 revision) (flutter/flutter#153806) 2024-08-21 [email protected] Roll Flutter Engine from 3d18f65c378a to 5cbf96d0a80f (3 revisions) (flutter/flutter#153804) 2024-08-21 [email protected] `_InteractiveViewerState` code cleanup (flutter/flutter#153645) 2024-08-20 [email protected] Roll Flutter Engine from b80c831e03f7 to 3d18f65c378a (1 revision) (flutter/flutter#153797) 2024-08-20 [email protected] Fix leaky test. (flutter/flutter#153798) 2024-08-20 [email protected] Fix leaky tests. (flutter/flutter#153786) 2024-08-20 [email protected] Roll Flutter Engine from 663176175b4c to b80c831e03f7 (1 revision) (flutter/flutter#153789) 2024-08-20 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Update template/test `compileSdk`, `targetSdk`, `ndk` versions (#152487)" (flutter/flutter#153793) 2024-08-20 [email protected] Update template/test `compileSdk`, `targetSdk`, `ndk` versions (flutter/flutter#152487) 2024-08-20 [email protected] add autofocus to fix a11y issue with dialog (flutter/flutter#152637) 2024-08-20 [email protected] [Release] Update bots to expect new entitlements (flutter/flutter#153787) 2024-08-20 [email protected] Roll Flutter Engine from d6bc4dc6e59d to 663176175b4c (1 revision) (flutter/flutter#153785) 2024-08-20 [email protected] Roll pub packages (flutter/flutter#153740) 2024-08-20 [email protected] Implement tap to scroll to item in CupertinoPicker (flutter/flutter#153386) 2024-08-20 [email protected] Fix leaky test. (flutter/flutter#153780) 2024-08-20 [email protected] Roll Flutter Engine from e10b07598091 to d6bc4dc6e59d (2 revisions) (flutter/flutter#153781) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
In input decoration if we are showing label as floating when it is focused, it scales down to `_kFinalLabelScale` i.e. 0.75 right now, but it was not mentioned anywhere. Resolves flutter#151406
In input decoration if we are showing label as floating when it is focused, it scales down to
_kFinalLabelScalei.e. 0.75 right now, but it was not mentioned anywhere.Resolves #151406
Pre-launch Checklist
///).