Skip to content

Conversation

@guidezpl
Copy link
Member

@guidezpl guidezpl commented May 27, 2022

  • Re-order information based on importance
  • Add section titles
  • Order and group components based on spec
  • Clarify language about lifecycle of the flag and future support
  • Add missing widgets
  • Fix issues with respect to style guide

This PR also adds links to relevant spec to all currently migrated widgets.

#91605

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.

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

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 27, 2022
@guidezpl
Copy link
Member Author

guidezpl commented May 27, 2022

For reference, this is what it looks like rendered
170676297-bcc95401-bd58-486e-8cbc-472f9a5f2b6d

/// * [Typography](https://m3.material.io/styles/typography): `typography` (see table below)
///
/// ## Components
/// * [Common buttons](https://m3.material.io/components/buttons): [TextButton], [OutlinedButton], [ElevatedButton]
Copy link
Member Author

@guidezpl guidezpl May 27, 2022

Choose a reason for hiding this comment

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

Perhaps, differentiate spec links from API doc links?

Or remove spec link:

Copy link
Contributor

Choose a reason for hiding this comment

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

I would opt for leaving the spec link out here. I think most of these have links to the spec in the individual component docs (or should if they don't).

Copy link
Member Author

Choose a reason for hiding this comment

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

I added spec links to all API docs

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.

The changes look OK to me and I agree that it's just as well if the API doc only links to API docs, not m3.material.io. Other than that, I defer to @darrenaustin

Copy link
Contributor

@darrenaustin darrenaustin 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 the cleanup. I just had some minor comments and one issue below.

/// * [Typography](https://m3.material.io/styles/typography): `typography` (see table below)
///
/// ## Components
/// * [Common buttons](https://m3.material.io/components/buttons): [TextButton], [OutlinedButton], [ElevatedButton]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would opt for leaving the spec link out here. I think most of these have links to the spec in the individual component docs (or should if they don't).

Comment on lines -1141 to -1143
/// some properties will get special defaults. However, just copying a [ThemeData]
/// with [useMaterial3] set to true will not change any of these properties in the
/// resulting [ThemeData]. These properties are:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need this description (or one like it here), as this is a distinction that a lot of people will miss and be confused when they don't get all the M3 features. A lot of apps tend to create a ThemeData with some default constructor like ThemeData.light() and then use .copyWith to configure it. If they do that with this property they won't get the new typography or splash factory defaults.

I would also like to see this above the component list as this is easily missed here at the bottom of the doc.

Copy link
Member Author

@guidezpl guidezpl May 30, 2022

Choose a reason for hiding this comment

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

Hmm I think that's a bug then. I would expect copyWith with useMaterial3 true to apply these updates, if I haven't provided my own typography and splashFactory, of course.

If I understand correctly, we're currently requiring every created theme out there (that doesn't use the factory constructor) to add the following?

...
typography: Typography.material2021(platform: platform),
splashFactory: platform == TargetPlatform.android && !kIsWeb ? InkSparkle.splashFactory ?  InkRipple.splashFactory,
)

It's not documented anywhere and is pretty brittle.

Nevertheless, that's out of scope for this PR, so I've moved this section above the styles and components sections.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I think that's a bug then. I would expect copyWith with useMaterial3 true to apply these updates, if I haven't provided my own typography and splashFactory, of course.

Not a bug so much as an easily misunderstood feature. copyWith just blindly overrides any given parameters, but does no other processing. Even if we want to special case this for useMaterial3, once a ThemeData is constructed, it will have non-null typography and splashFactory settings. We would not be able to tell if you have provided your own or if they were default.

If I understand correctly, we're currently requiring every created theme out there (that doesn't use the factory constructor) to add the following?

...
typography: Typography.material2021(platform: platform),
splashFactory: platform == TargetPlatform.android && !kIsWeb ? InkSparkle.splashFactory ?  InkRipple.splashFactory,
)

There is no way to construct a ThemeData that doesn't use the factory constructor other than ThemeData.raw or ThemeData.copyWith (which itself uses .raw). Unless I am missing something here.

If people want to use copyWith in conjunction with useMaterial3 they will get most of the features, just not the ones that have defaults set in the factory constructor (hence the description in the docs).

Nevertheless, that's out of scope for this PR, so I've moved this section above the styles and components sections.

Thanks.

@flutter-dashboard flutter-dashboard bot added the a: text input Entering text in a text field or keyboard related problems label May 30, 2022
@guidezpl guidezpl requested a review from darrenaustin June 1, 2022 13:47
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

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

Sorry for the lag on my review. LGTM. Thx.

@guidezpl guidezpl merged commit 8f57f87 into flutter:master Jun 8, 2022
@guidezpl guidezpl deleted the m3-docs branch June 8, 2022 09:50
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 8, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
* Improve `useMaterial3` documentation

* reverse styles and components

* tweak language around support

* Update theme_data.dart

* remove trailing space

* Update packages/flutter/lib/src/material/theme_data.dart

Co-authored-by: Darren Austin <[email protected]>

* add missing spec links

* remove spec links from useMaterial3

* move defaults section up, rejig things

* spaces no longer trailing

* spaces no longer trailing (2)

Co-authored-by: Darren Austin <[email protected]>
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 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.

3 participants