Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Mar 26, 2024

Description

  • Add a check to verify template code in the Material library is synced with gen_defaults
  • Sync the changes to pass the new check.

Pre-launch Checklist

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

@TahaTesser TahaTesser marked this pull request as ready for review March 26, 2024 11:00
@TahaTesser TahaTesser requested a review from guidezpl March 26, 2024 11:00
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

@TahaTesser

This comment was marked as resolved.

@TahaTesser TahaTesser force-pushed the sync_templates branch 3 times, most recently from 5c710df to 7ecc6a1 Compare April 1, 2024 07:45
@TahaTesser

This comment was marked as resolved.

@guidezpl
Copy link
Member

guidezpl commented Apr 2, 2024

Feel free to get a second review

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

This will also need a test or a test exception (see bot message).

@TahaTesser TahaTesser changed the title Fix out of sync templates files for FAB switch expressions and unused tokens Fix out of sync templates files and add a check Apr 3, 2024
@TahaTesser

This comment was marked as resolved.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Apr 3, 2024
@TahaTesser TahaTesser force-pushed the sync_templates branch 3 times, most recently from cf9f30b to 9cfe768 Compare April 3, 2024 14:52
@TahaTesser TahaTesser requested a review from goderbauer April 3, 2024 15:20
@TahaTesser
Copy link
Member Author

Add a test in analayze_test.dart

@QuncCccccc
Copy link
Contributor

Thanks for adding this check!! It was on my todo list but never got implemented...

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM, I leave the final review to @QuncCccccc.

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

Thanks for adding this improvement! Just added one comment below and will take another look later today (sorry still need some time to understand the test for analyser).

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why we have the change here. When it is focused, we still want to see the hover effect, right? So probably hovered state should be put above focused?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was a change from another PR which wasn't synced with the template class. I synced it here to pass the new check.

cc: @bleroux

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see. I found the PR change: #146127
Looks like this is expected, can we add a comment above so this will not cause any confusion. Usually we'll have a order: pressed->hovered->focused. Here is a little more explanation: #125905 😄

Copy link
Contributor

@bleroux bleroux Apr 9, 2024

Choose a reason for hiding this comment

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

Hey @QuncCccccc!

My PR which introduced this change, #146127, landed just before Taha implemented this new analyser test. Thanks to this new test, Taha spotted that I forgot to update the template. Instead of me filing a PR to update the template we decided that it will be ok to do it in this PR.

About the change itself, the problem with having the hovered state taking precedence over the focused one is especially noticeable on text field: the focused state for a text field increases border width (2dp) and applies bright colors (primary color or error color) while the hover state has the same border than a non focused text field (1dp) and use a color a little darker that a non focused text field. On desktop, it is also very common that a text field is focused and hovered (when users rely mainly on their mouse), so with the previous implementation when the text field was hovered it feels more or less as it lost focus:

Enregistrement.de.l.ecran.2024-04-09.a.22.23.01.mov

The M3 specification did not specify the exact behavior for this kind of visual properties impacted by hovered/focused states. What they explain in details is that hover is meant as a layer above the component but that is applicable for filled area not for text style and border like this.

I compared with other M3 implementations, especially https://material-web.dev/components/text-field/, and focus state takes precedence over hovered state for text field border (and also for the label color, that's not the case for Flutter text field for the moment).

I plan to file a similar PR for the label text color, I think it will be great to discuss that topic together on this coming PR, there might be cases I missed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. This totally makes sense to me! Thanks for the explanation! I think adding a comment above would be helpful because other widgets have a reversed order:)

Copy link
Member

Choose a reason for hiding this comment

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

+1, focus taking preference over hovered state is the design intention

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. This totally makes sense to me! Thanks for the explanation! I think adding a comment above would be helpful because other widgets have a reversed order:)

To avoid blocking Taha's PR, I added the detailed comment on #146572

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question for my education. Looks like the chip_template.dart has the same content as the chip.dart in dev/bots/test/dev/bots/test/analyze-gen-defaults, why here shouldHaveErrors is true?

Copy link
Member Author

Choose a reason for hiding this comment

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

Test string description is different. I think i didn't make it different enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah chip_template.dart vs chip.dart! Got it!

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks again for the fix:)!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah chip_template.dart vs chip.dart! Got it!

@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. f: integration_test The flutter/packages/integration_test plugin labels Apr 11, 2024
@github-actions github-actions bot removed a: tests "flutter test", flutter_test, or one of our tests tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. f: integration_test The flutter/packages/integration_test plugin labels Apr 11, 2024
@TahaTesser TahaTesser added a: tests "flutter test", flutter_test, or one of our tests tool Affects the "flutter" command-line tool. See also t: labels. and removed tool Affects the "flutter" command-line tool. See also t: labels. labels Apr 11, 2024
Copy link
Member

Choose a reason for hiding this comment

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

seems a bit strange to copy this file, is this common?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just for the test folder. Generator in the gen_defaults cannot update test file in the dev/bots

There are similar test folders in the dev/bots folder

https://github.com/flutter/flutter/tree/master/dev/bots/test/analyze-test-input/root/packages/flutter/lib

@TahaTesser TahaTesser added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 11, 2024
@auto-submit auto-submit bot merged commit 9436b3c into flutter:master Apr 11, 2024
@TahaTesser TahaTesser deleted the sync_templates branch April 11, 2024 13:40
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 11, 2024
flutter/flutter@97cd47a...557fbf5

2024-04-11 [email protected] Update app Android gradle scripts to use flutter.versionName and flutter.versionCode (flutter/flutter#146604)
2024-04-11 [email protected] Fix out of sync templates files and add a check (flutter/flutter#145747)
2024-04-11 [email protected] [tools] Fix `--template=plugin_ffi` formatting (flutter/flutter#146269)
2024-04-11 [email protected] Roll Flutter Engine from 40b0f81332cb to d8560d495d9f (1 revision) (flutter/flutter#146622)
2024-04-11 [email protected] Roll Flutter Engine from fef8499fb9bf to 40b0f81332cb (1 revision) (flutter/flutter#146621)
2024-04-11 [email protected] Fix `IconButton` theming in the `InputDecorator` (flutter/flutter#146567)
2024-04-11 [email protected] Roll Flutter Engine from e2a45bda45cb to fef8499fb9bf (1 revision) (flutter/flutter#146619)
2024-04-11 [email protected] Roll Flutter Engine from e47dc9a7a24d to e2a45bda45cb (1 revision) (flutter/flutter#146618)
2024-04-11 [email protected] Roll Flutter Engine from 069e73eaef34 to e47dc9a7a24d (1 revision) (flutter/flutter#146617)
2024-04-11 [email protected] Roll Flutter Engine from 28ed19073fcf to 069e73eaef34 (1 revision) (flutter/flutter#146613)
2024-04-11 [email protected] Roll Flutter Engine from 4e33a0b47e3d to 28ed19073fcf (1 revision) (flutter/flutter#146611)
2024-04-11 [email protected] Roll Flutter Engine from 6f8ee9ffd9fa to 4e33a0b47e3d (3 revisions) (flutter/flutter#146609)
2024-04-10 [email protected] Roll Flutter Engine from 91ba23575c82 to 6f8ee9ffd9fa (4 revisions) (flutter/flutter#146607)
2024-04-10 [email protected] Disable single character mode in the terminal when exiting flutter_tools (flutter/flutter#146534)
2024-04-10 [email protected] Roll pub packages (flutter/flutter#146606)
2024-04-10 [email protected] Roll Flutter Engine from beee02b5ba2d to 91ba23575c82 (4 revisions) (flutter/flutter#146605)
2024-04-10 [email protected] Remove additional references to engine v1 android embedding (flutter/flutter#146523)
2024-04-10 [email protected] Roll Flutter Engine from 077b742550ef to beee02b5ba2d (2 revisions) (flutter/flutter#146591)
2024-04-10 [email protected] Roll Flutter Engine from 0d5412d4ee4b to 077b742550ef (1 revision) (flutter/flutter#146585)
2024-04-10 [email protected] Convert ProjectMigration and ProjectMigrator to be async (flutter/flutter#146537)
2024-04-10 [email protected] Roll Flutter Engine from cee489a4e275 to 0d5412d4ee4b (7 revisions) (flutter/flutter#146577)
2024-04-10 [email protected] Roll Packages from 17f55d3 to 2c15d86 (2 revisions) (flutter/flutter#146575)

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] 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
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
### Description
- Add a check to verify template code in the Material library is synced with `gen_defaults`
- Sync the changes to pass the new check.
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
flutter/flutter@97cd47a...557fbf5

2024-04-11 [email protected] Update app Android gradle scripts to use flutter.versionName and flutter.versionCode (flutter/flutter#146604)
2024-04-11 [email protected] Fix out of sync templates files and add a check (flutter/flutter#145747)
2024-04-11 [email protected] [tools] Fix `--template=plugin_ffi` formatting (flutter/flutter#146269)
2024-04-11 [email protected] Roll Flutter Engine from 40b0f81332cb to d8560d495d9f (1 revision) (flutter/flutter#146622)
2024-04-11 [email protected] Roll Flutter Engine from fef8499fb9bf to 40b0f81332cb (1 revision) (flutter/flutter#146621)
2024-04-11 [email protected] Fix `IconButton` theming in the `InputDecorator` (flutter/flutter#146567)
2024-04-11 [email protected] Roll Flutter Engine from e2a45bda45cb to fef8499fb9bf (1 revision) (flutter/flutter#146619)
2024-04-11 [email protected] Roll Flutter Engine from e47dc9a7a24d to e2a45bda45cb (1 revision) (flutter/flutter#146618)
2024-04-11 [email protected] Roll Flutter Engine from 069e73eaef34 to e47dc9a7a24d (1 revision) (flutter/flutter#146617)
2024-04-11 [email protected] Roll Flutter Engine from 28ed19073fcf to 069e73eaef34 (1 revision) (flutter/flutter#146613)
2024-04-11 [email protected] Roll Flutter Engine from 4e33a0b47e3d to 28ed19073fcf (1 revision) (flutter/flutter#146611)
2024-04-11 [email protected] Roll Flutter Engine from 6f8ee9ffd9fa to 4e33a0b47e3d (3 revisions) (flutter/flutter#146609)
2024-04-10 [email protected] Roll Flutter Engine from 91ba23575c82 to 6f8ee9ffd9fa (4 revisions) (flutter/flutter#146607)
2024-04-10 [email protected] Disable single character mode in the terminal when exiting flutter_tools (flutter/flutter#146534)
2024-04-10 [email protected] Roll pub packages (flutter/flutter#146606)
2024-04-10 [email protected] Roll Flutter Engine from beee02b5ba2d to 91ba23575c82 (4 revisions) (flutter/flutter#146605)
2024-04-10 [email protected] Remove additional references to engine v1 android embedding (flutter/flutter#146523)
2024-04-10 [email protected] Roll Flutter Engine from 077b742550ef to beee02b5ba2d (2 revisions) (flutter/flutter#146591)
2024-04-10 [email protected] Roll Flutter Engine from 0d5412d4ee4b to 077b742550ef (1 revision) (flutter/flutter#146585)
2024-04-10 [email protected] Convert ProjectMigration and ProjectMigrator to be async (flutter/flutter#146537)
2024-04-10 [email protected] Roll Flutter Engine from cee489a4e275 to 0d5412d4ee4b (7 revisions) (flutter/flutter#146577)
2024-04-10 [email protected] Roll Packages from 17f55d3 to 2c15d86 (2 revisions) (flutter/flutter#146575)

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] 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants