Skip to content

Conversation

@MitchellGoodwin
Copy link
Contributor

@MitchellGoodwin MitchellGoodwin commented Jul 25, 2024

Increases the max text can be scaled for the date picker in calendar mode and input mode. Previously the max across the whole widget was 1.3. Due to the size of the widget, this was increased as much as possible with different values used in different places. Testing and screenshots where taken on the iPhone SE 3rd generation simulator, set at max font size, which is a value of 3.0. Android has a lower max font scale value of 2.0, and the iPhone SE is about the smallest phone with a lower pixel density ratio.

Fixes internal issues b/316958515 and b/316959677
Also fixes #61334

Comparison for calendar mode in portrait and landscape:

Before After
Old-SE-Portrait-DayPicker Screenshot 2024-07-25 at 1 25 41 PM
Old-SE-Portrait-YearPicker Screenshot 2024-07-25 at 1 26 38 PM
Old-SE-Landscape-DayPicker Screenshot 2024-07-25 at 1 25 52 PM
Old-SE-Landscape-YearPicker Screenshot 2024-07-25 at 1 26 47 PM

The title text is smaller when the entry mode button is available:
Screenshot 2024-07-25 at 1 24 52 PM

Adjustments were made to input mode as well, but they are simpler

Screenshot 2024-07-25 at 1 43 39 PM Screenshot 2024-07-25 at 1 43 48 PM

Date range picker was not adjusted with this PR. It still has a max of 1.3.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jul 25, 2024
@chunhtai
Copy link
Contributor

Does the 3 font scale limit covers all the possible font scaling set by the android and ios phone? otherwise, It would seem weird the widget stop scaling suddenly compare to other widgets in the app.

@MitchellGoodwin
Copy link
Contributor Author

Does the 3 font scale limit covers all the possible font scaling set by the android and ios phone? otherwise, It would seem weird the widget stop scaling suddenly compare to other widgets in the app.

Yes, 3.0 is the highest iOS phones can go, currently. Android has a lower max of 2.0, so 3.0 will cover both.

In different sections of the widget, I used a lower max somewhat strategically. Having a max of 3.0 globally caused a lot of overflow and clipping errors. So the header text doesn't scale as much up, because it already has large text compared to the rest of the widget.

assert(debugCheckHasMaterial(context));
assert(debugCheckHasMaterialLocalizations(context));
assert(debugCheckHasDirectionality(context));
const double fontSizeToScale = 14.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this int come from? Should we get this value from DefaultTextStyle instead?

assert(debugCheckHasMaterialLocalizations(context));
assert(debugCheckHasDirectionality(context));
const double fontSizeToScale = 14.0;
final double textScaleFactor = MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 3.0).scale(fontSizeToScale) / fontSizeToScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a const for 3.0 and name it something like maxScalingFromMobileDevice and add some comment to explain how this value come from?

final double textScaleFactor = MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 3.0).scale(fontSizeToScale) / fontSizeToScale;
// Scale the height of the picker area up with larger text.
final double scaledMaxDayPickerHeight =
textScaleFactor > 1.3 ? _maxDayPickerHeight + ((_maxDayPickerRowCount + 1) * ((textScaleFactor - 1) * 8)) : _maxDayPickerHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason we set the height flat before 1.3 scaling? If there is a reason, can you add some comment or use const with name for readability?

dayItems,
addRepaintBoundaries: false,
child: MediaQuery.withClampedTextScaling(
maxScaleFactor: isLandscapeOrientation ? 1.5 : 2.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, instead of some inline magic number, we should define a const with reasonable name for readability


@override
SliverGridLayout getLayout(SliverConstraints constraints) {
const double fontSizeToScale = 14.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, should we get this from defaulttextstyle?

@MitchellGoodwin
Copy link
Contributor Author

@chunhtai I put all of the magic numbers into constants at the top of the files with documentation. Maybe of note is that the 14.0 was only used to get the ratio of the text scaling, so it's not too important what the size actually is, as long as it's consistent.

@chunhtai
Copy link
Contributor

@chunhtai I put all of the magic numbers into constants at the top of the files with documentation. Maybe of note is that the 14.0 was only used to get the ratio of the text scaling, so it's not too important what the size actually is, as long as it's consistent.

Android has non linear scaling for font size, that is. The larger the font size it is, the less scaling it will receive. Although I think this is probably ok since there shouldn't be extreme font size in datepicker.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MitchellGoodwin MitchellGoodwin marked this pull request as ready for review July 31, 2024 17:30
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #152341 at sha 1718ed3

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Jul 31, 2024
@MitchellGoodwin MitchellGoodwin added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 31, 2024
@auto-submit auto-submit bot merged commit 91a3f69 into flutter:master Jul 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 3, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 3, 2024
Manual roll Flutter from 85960d2 to 4ff9462 (45 revisions)

Manual roll requested by [email protected]

flutter/flutter@85960d2...4ff9462

2024-08-01 [email protected] Fix local testing, gradle XML errors, and enable on CI. (flutter/flutter#152383)
2024-08-01 [email protected] Fix formatting issues in `search_anchor.0_test.dart` (flutter/flutter#152669)
2024-08-01 [email protected] Add tests for search anchor examples (flutter/flutter#152659)
2024-08-01 [email protected] Roll Flutter Engine from 4dc94d6f88ba to 7c4a44611abe (1 revision) (flutter/flutter#152665)
2024-08-01 [email protected] Roll Flutter Engine from f546fef7d7cd to 4dc94d6f88ba (1 revision) (flutter/flutter#152663)
2024-08-01 [email protected] Roll Flutter Engine from 0fbff219c498 to f546fef7d7cd (2 revisions) (flutter/flutter#152661)
2024-08-01 [email protected] Roll Flutter Engine from 32f788823f43 to 0fbff219c498 (5 revisions) (flutter/flutter#152658)
2024-08-01 [email protected] Manual roll Flutter Engine from 32f788823f43 to ed95b491f260 (3 revisions) (flutter/flutter#152654)
2024-08-01 [email protected] Manual roll Flutter Engine from 16332725788c to 32f788823f43 (11 revisions) (flutter/flutter#152648)
2024-07-31 [email protected] [CupertinoActionSheet] Make `_ActionSheetButtonBackground` stateless (flutter/flutter#152283)
2024-07-31 [email protected] Implementing null-aware logic in `/packages/flutter/` (flutter/flutter#152294)
2024-07-31 [email protected] Reintroduce verbose logging for hot reload flake (flutter/flutter#152639)
2024-07-31 [email protected] [material/menu_anchor.dart] Remove unused early key event listener (flutter/flutter#150915)
2024-07-31 [email protected] Improve `CupertinoCheckbox` fidelity (flutter/flutter#151441)
2024-07-31 [email protected] Update docs to support new Android version (flutter/flutter#152503)
2024-07-31 [email protected] [Android] Update integration test AVD dependency to use Android 35 emulators (flutter/flutter#152498)
2024-07-31 [email protected] Shift + click gesture support for SelectionArea on desktop platforms (flutter/flutter#148574)
2024-07-31 [email protected] Add ability to clip `Stepper` step content (flutter/flutter#152370)
2024-07-31 [email protected] Calendar font factor (flutter/flutter#152341)
2024-07-31 [email protected] Remove redundant usages of zones in skia_client.dart (flutter/flutter#149366)
2024-07-31 [email protected] Set up tests that verify we can build a fresh counter app across our Gradle/AGP/Kotlin support range (flutter/flutter#151568)
2024-07-31 [email protected] remove bringup from Windows tool_integration_tests_* (flutter/flutter#152599)
2024-07-31 [email protected] â�¨ : Animation controller now has ability to repeat animation 'n' no. of times. (flutter/flutter#150764)
2024-07-31 [email protected] Roll Flutter Engine from 3b31b21599d1 to 16332725788c (1 revision) (flutter/flutter#152631)
2024-07-31 [email protected] Roll Flutter Engine from b73367a30e9b to 3b31b21599d1 (8 revisions) (flutter/flutter#152625)
2024-07-31 [email protected] Roll Packages from 99e8606 to 46a712f (8 revisions) (flutter/flutter#152622)
2024-07-31 [email protected] Add tests for scaffold messenger examples (flutter/flutter#152536)
2024-07-31 [email protected] Add test for search_anchor.0.dart (flutter/flutter#152371)
2024-07-31 [email protected] Use decoration hint text as the default value for dropdown button hints (flutter/flutter#152474)
2024-07-31 [email protected] Deprecate invalid InputDecoration.collapsed parameters (flutter/flutter#152486)
2024-07-31 [email protected] increase sharding on Windows tool_integration_tests (flutter/flutter#152582)
2024-07-31 [email protected] Roll Flutter Engine from e2ece7e58480 to b73367a30e9b (4 revisions) (flutter/flutter#152592)
2024-07-31 [email protected] Roll Flutter Engine from 0b42657a184e to e2ece7e58480 (2 revisions) (flutter/flutter#152589)
2024-07-31 [email protected] Roll Flutter Engine from 08f9be3ab284 to 0b42657a184e (2 revisions) (flutter/flutter#152586)
2024-07-30 [email protected] Clarify and cleanup the test-exemption wording in tree-hygiene. (flutter/flutter#152402)
2024-07-30 [email protected] [web] Set COEP:credentialless on flutter run/drive. (flutter/flutter#152413)
2024-07-30 [email protected] Roll Flutter Engine from a4b88a37d511 to 08f9be3ab284 (5 revisions) (flutter/flutter#152583)
2024-07-30 [email protected] Marks Mac platform_channel_sample_test_macos to be flaky (flutter/flutter#151884)
2024-07-30 [email protected] Roll Flutter Engine from a6c5ff26c266 to a4b88a37d511 (2 revisions) (flutter/flutter#152575)
2024-07-30 [email protected] Reland #151599 (Add button semantics in list tile ) with a flag to control behavior.  (flutter/flutter#152526)
2024-07-30 [email protected] Shift macOS/Android tests from Pixel 7 to mokey in staging (flutter/flutter#152571)
2024-07-30 [email protected] Roll Flutter Engine from 31bb9f98472a to a6c5ff26c266 (5 revisions) (flutter/flutter#152573)
2024-07-30 [email protected] Roll Packages from 247fb5f to 99e8606 (5 revisions) (flutter/flutter#152567)
2024-07-30 [email protected] Fix default avatar icon theme size for Material 2 (flutter/flutter#152307)
...
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
Increases the max text can be scaled for the date picker in calendar mode and input mode. Previously the max across the whole widget was 1.3. Due to the size of the widget, this was increased as much as possible with different values used in different places. Testing and screenshots where taken on the iPhone SE 3rd generation simulator, set at max font size, which is a value of 3.0. Android has a lower max font scale value of 2.0, and the iPhone SE is about the smallest phone with a lower pixel density ratio.

Fixes internal issues b/316958515 and b/316959677 
Also fixes flutter#61334

Comparison for calendar mode in portrait and landscape:

| Before    | After |
| -------- | ------- |
| <img width="375" alt="Old-SE-Portrait-DayPicker" src="https://github.com/user-attachments/assets/4dd1735f-f4c7-4a0a-b8d3-e5ea84d2ba3c"> | <img width="376" alt="Screenshot 2024-07-25 at 1 25 41�PM" src="https://github.com/user-attachments/assets/a53d7d68-87ef-4b29-9479-36ef22bd6cc9"> |
| <img width="375" alt="Old-SE-Portrait-YearPicker" src="https://github.com/user-attachments/assets/37c2965d-1ec0-429b-aa4d-37396f90cb74"> | <img width="377" alt="Screenshot 2024-07-25 at 1 26 38�PM" src="https://github.com/user-attachments/assets/2a00d90f-d523-4ff5-a1d7-e1bfafb245d3"> |
| <img width="665" alt="Old-SE-Landscape-DayPicker" src="https://github.com/user-attachments/assets/1cc4cd26-d56a-4f35-88b1-1c13fa460c2f"> | <img width="665" alt="Screenshot 2024-07-25 at 1 25 52�PM" src="https://github.com/user-attachments/assets/729ac66c-d6b9-4a2a-8303-b5c9face0f62"> |
| <img width="664" alt="Old-SE-Landscape-YearPicker" src="https://github.com/user-attachments/assets/f00a9ab8-1925-4c33-bfcc-31020b2858b8"> | <img width="666" alt="Screenshot 2024-07-25 at 1 26 47�PM" src="https://github.com/user-attachments/assets/d6116c20-4862-4e07-8ab4-fb8ecb71bfa5"> |

The title text is smaller when the entry mode button is available:
<img width="374" alt="Screenshot 2024-07-25 at 1 24 52�PM" src="https://github.com/user-attachments/assets/83305c11-97d5-4986-bf51-fe0be71f653e">

Adjustments were made to input mode as well, but they are simpler

<img width="372" alt="Screenshot 2024-07-25 at 1 43 39�PM" src="https://github.com/user-attachments/assets/2440cf6f-160f-4689-978e-d0a3df2db102">
<img width="666" alt="Screenshot 2024-07-25 at 1 43 48�PM" src="https://github.com/user-attachments/assets/e8d8dbf3-c7d8-4668-9245-7b5036165e75">

Date range picker was not adjusted with this PR. It still has a max of 1.3.
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
Increases the max text can be scaled for the date picker in calendar mode and input mode. Previously the max across the whole widget was 1.3. Due to the size of the widget, this was increased as much as possible with different values used in different places. Testing and screenshots where taken on the iPhone SE 3rd generation simulator, set at max font size, which is a value of 3.0. Android has a lower max font scale value of 2.0, and the iPhone SE is about the smallest phone with a lower pixel density ratio.

Fixes internal issues b/316958515 and b/316959677 
Also fixes flutter#61334

Comparison for calendar mode in portrait and landscape:

| Before    | After |
| -------- | ------- |
| <img width="375" alt="Old-SE-Portrait-DayPicker" src="https://github.com/user-attachments/assets/4dd1735f-f4c7-4a0a-b8d3-e5ea84d2ba3c"> | <img width="376" alt="Screenshot 2024-07-25 at 1 25 41�PM" src="https://github.com/user-attachments/assets/a53d7d68-87ef-4b29-9479-36ef22bd6cc9"> |
| <img width="375" alt="Old-SE-Portrait-YearPicker" src="https://github.com/user-attachments/assets/37c2965d-1ec0-429b-aa4d-37396f90cb74"> | <img width="377" alt="Screenshot 2024-07-25 at 1 26 38�PM" src="https://github.com/user-attachments/assets/2a00d90f-d523-4ff5-a1d7-e1bfafb245d3"> |
| <img width="665" alt="Old-SE-Landscape-DayPicker" src="https://github.com/user-attachments/assets/1cc4cd26-d56a-4f35-88b1-1c13fa460c2f"> | <img width="665" alt="Screenshot 2024-07-25 at 1 25 52�PM" src="https://github.com/user-attachments/assets/729ac66c-d6b9-4a2a-8303-b5c9face0f62"> |
| <img width="664" alt="Old-SE-Landscape-YearPicker" src="https://github.com/user-attachments/assets/f00a9ab8-1925-4c33-bfcc-31020b2858b8"> | <img width="666" alt="Screenshot 2024-07-25 at 1 26 47�PM" src="https://github.com/user-attachments/assets/d6116c20-4862-4e07-8ab4-fb8ecb71bfa5"> |

The title text is smaller when the entry mode button is available:
<img width="374" alt="Screenshot 2024-07-25 at 1 24 52�PM" src="https://github.com/user-attachments/assets/83305c11-97d5-4986-bf51-fe0be71f653e">

Adjustments were made to input mode as well, but they are simpler

<img width="372" alt="Screenshot 2024-07-25 at 1 43 39�PM" src="https://github.com/user-attachments/assets/2440cf6f-160f-4689-978e-d0a3df2db102">
<img width="666" alt="Screenshot 2024-07-25 at 1 43 48�PM" src="https://github.com/user-attachments/assets/e8d8dbf3-c7d8-4668-9245-7b5036165e75">

Date range picker was not adjusted with this PR. It still has a max of 1.3.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[showDatePicker] RenderFlex overflow exception with orientation of Axis.vertical and setting the text size to smallest from device settings.

2 participants