Skip to content

Conversation

darrenaustin
Copy link
Contributor

@darrenaustin darrenaustin commented Jul 8, 2022

The current gen_defaults script will only allow a single block of code to be appended to the end of a file. This PR refactors it such that each block is given a name and can be anywhere in the file and updated properly. This will allow us to have multiple generated blocks in a given file and have them updated independently. This in turn will make it easier to support multiple variants of tokens in a single file (say for different button variants).

In addition I added some more internal documentation as well as a new test to check the updating of multiple blocks in a file.

As part of this PR I regenerated all the existing code blocks to match the new format. While doing so, I took the liberty to clean up the naming for the generated (FooDefaultsM3) and hand coded (FooDefaultsM2) FooThemeData classes so that they are consistent across all the widgets.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Jul 8, 2022
Copy link
Member

@guidezpl guidezpl left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

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!

@darrenaustin darrenaustin merged commit d4061c1 into flutter:master Jul 11, 2022
@darrenaustin darrenaustin deleted the gen_defaults_multiple_blocks branch July 11, 2022 00:17
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 12, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. 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.

4 participants