Skip to content
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

Deprecate useMaterial3 parameter in ThemeData.copyWith() #131455

Merged

Conversation

QuncCccccc
Copy link
Contributor

@QuncCccccc QuncCccccc commented Jul 28, 2023

This PR is to deprecate useMaterial3 parameter in ThemeData.copyWith().

Setting useMaterial3 to false in ThemeData.copyWith() doesn't force Flutter to use Material 2, instead, we should set it in ThemeData() directly. The documentation of useMaterial3 has covered this limitation: https://api.flutter.dev/flutter/material/ThemeData/useMaterial3.html, but it still likely to be misused in the .copyWith() method.

A related issue happens in b/292560771

Related to #131041

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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. c: tech-debt Technical debt, code quality, testing, etc. labels Jul 28, 2023
Comment on lines 1640 to 1641
'Use ThemeData.useMaterial3 instead. '
'Setting this value cannot successfully change the default theme. '
Copy link
Member

@guidezpl guidezpl Jul 28, 2023

Choose a reason for hiding this comment

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

Suggested change
'Use ThemeData.useMaterial3 instead. '
'Setting this value cannot successfully change the default theme. '
'Use a ThemeData constructor (.from, .light, or .dark) instead. '
'These constructors all have a useMaterial3 argument, and they set appropriate default values based on its value. See the useMaterial3 API documentation for full details.'

@@ -25,6 +25,17 @@
# * TextTheme: fix_text_theme.yaml
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/131455
Copy link
Member

Choose a reason for hiding this comment

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

this should be moved to the bottom

@QuncCccccc QuncCccccc force-pushed the deprecate_use_material_3_in_copy_with branch from 016f737 to 939e3db Compare July 28, 2023 06:25
@QuncCccccc QuncCccccc marked this pull request as ready for review July 28, 2023 06:25
@QuncCccccc QuncCccccc merged commit 3567140 into flutter:master Jul 28, 2023
72 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 29, 2023
flutter/flutter@e81907e...c2b40ca

2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 24ccd8fffbcb to 5184062f7543 (2 revisions) (flutter/flutter#131554)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 90bc483524fe to 24ccd8fffbcb (1 revision) (flutter/flutter#131540)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 27128f29a066 to 90bc483524fe (2 revisions) (flutter/flutter#131535)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 69b5b77edaf7 to 27128f29a066 (1 revision) (flutter/flutter#131533)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from b854fdea2715 to 69b5b77edaf7 (1 revision) (flutter/flutter#131532)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 0a5b2f521539 to b854fdea2715 (1 revision) (flutter/flutter#131530)
2023-07-29 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.0 to 2.21.2 (flutter/flutter#131512)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from f5c17f0e2406 to 0a5b2f521539 (2 revisions) (flutter/flutter#131529)
2023-07-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from b4bf592279d6 to f5c17f0e2406 (1 revision) (flutter/flutter#131525)
2023-07-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from da3721adba65 to b4bf592279d6 (2 revisions) (flutter/flutter#131519)
2023-07-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from aa1278eb7b84 to da3721adba65 (5 revisions) (flutter/flutter#131514)
2023-07-28 leroux_bruno@yahoo.fr Reland - Fix floating SnackBar throws when FAB is on the top (flutter/flutter#131475)
2023-07-28 ian@hixie.ch Device discovery output cleanup (flutter/flutter#131223)
2023-07-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from 182e1189873b to aa1278eb7b84 (2 revisions) (flutter/flutter#131500)
2023-07-28 tessertaha@gmail.com Update `BottomSheet.enableDrag`  & `BottomSheet.showDragHandle` docs for animation controller (flutter/flutter#131484)
2023-07-28 36861262+QuncCccccc@users.noreply.github.com Deprecate `useMaterial3` parameter in `ThemeData.copyWith()` (flutter/flutter#131455)
2023-07-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from 73615d66b2fe to 182e1189873b (2 revisions) (flutter/flutter#131492)
2023-07-28 tessertaha@gmail.com Add `CheckedPopupMenuItem�.labelTextStyle` and update default text style for Material 3 (flutter/flutter#131060)
2023-07-28 ychris@google.com Remove obsolete `complex_layout_ios__compile.dart` test (flutter/flutter#131487)
2023-07-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from e97014c71014 to 73615d66b2fe (3 revisions) (flutter/flutter#131485)
2023-07-28 chevalier.dan@gmail.com Shared state to support multi screen inspection  (flutter/flutter#129452)
2023-07-28 engine-flutter-autoroll@skia.org Roll Packages from f4ae933 to 10aab44 (4 revisions) (flutter/flutter#131483)
2023-07-28 ychris@google.com Move ios_app_with_extensions_test to host only (flutter/flutter#131441)
2023-07-28 tessertaha@gmail.com Update `Card.color` documentation for Material 3 (flutter/flutter#131468)

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 rmistry@google.com,stuartmorgan@google.com,tarrinneal@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
vashworth pushed a commit to vashworth/flutter that referenced this pull request Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: tech-debt Technical debt, code quality, testing, etc. 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.

[Proposal] Deprecate ThemeData.copyWith's colorScheme and useMaterial3 arguments
2 participants