Skip to content

Migrate common buttons to Material 3 - #100794

Merged
darrenaustin merged 11 commits into
flutter:masterfrom
darrenaustin:m3_buttons
Apr 9, 2022
Merged

darrenaustin merged 11 commits into
flutter:masterfrom
darrenaustin:m3_buttons

Conversation

@darrenaustin

@darrenaustin darrenaustin commented Mar 25, 2022 •

Copy link
Copy Markdown
Contributor

Part of: #91605

Updated the common buttons: ElevatedButton, OutlinedButton, and TextButton with support for Material Design 3.

M3 Buttons

M3 Buttons Dark

In order to use the common buttons with the new Material 3 defaults, turn on the useMaterial3 flag in the ThemeData:

  return MaterialApp(
    theme: ThemeData(useMaterial3: true),
    // ...
  );

Also, if you use ElevatedButton.styleFrom please read the documentation about color role changes in M3 that you may need to account for.

Fixes: #99022
Fixes: #99884

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 p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Mar 25, 2022
@darrenaustin
darrenaustin requested review from HansMuller and guidezpl and removed request for HansMuller March 25, 2022 20:12

@HansMuller HansMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is looking good. Just has one basic question...

Comment thread packages/flutter/lib/src/material/elevated_button.dart Outdated
Comment thread packages/flutter/lib/src/material/elevated_button.dart Outdated
Comment thread packages/flutter/lib/src/material/elevated_button.dart Outdated
@flutter-dashboard flutter-dashboard Bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation labels Mar 28, 2022
Comment thread packages/flutter/lib/src/material/elevated_button.dart Outdated

@clocksmith clocksmith left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add test for conditional splashFactory?

something like: https://github.com/flutter/flutter/pull/101046/files

@darrenaustin

Copy link
Copy Markdown
Contributor Author

Add test for conditional splashFactory?

something like: https://github.com/flutter/flutter/pull/101046/files

Yeah, I need to add a bunch of tests here. Will do so after I figure out a cleaner solution for the styleFrom issues.

@dimstr dimstr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's very beautiful.

Comment thread examples/api/lib/material/elevated_button/elevated_button.1.dart Outdated
@darrenaustin
darrenaustin requested a review from HansMuller April 7, 2022 00:51
@darrenaustin
darrenaustin requested a review from clocksmith April 7, 2022 00:51

@HansMuller HansMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread dev/tools/gen_defaults/lib/button_template.dart
Comment thread packages/flutter/lib/src/material/elevated_button.dart Outdated
Comment thread examples/api/lib/material/button_style/button_style.0.dart Outdated
@darrenaustin
darrenaustin merged commit c14ca6d into flutter:master Apr 9, 2022
@darrenaustin
darrenaustin deleted the m3_buttons branch April 9, 2022 00:03
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2022
@itsjustkevin itsjustkevin added cp: review Cherry-picks in the review queue cp: approved Approved cherry-pick request labels Apr 15, 2022
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request Apr 20, 2022
CaseyHillers pushed a commit that referenced this pull request Apr 20, 2022
…102193)

* Ensure that the engine frame callbacks are installed if the first scheduled frame is a forced frame (#101544)

See #98419

* Migrate common buttons to Material 3 (#100794)

* Always finish the timeline event logged by Element.inflateWidget (#101794)

* 'Create candidate branch version flutter-2.13-candidate.0 for beta'

* 'Update Engine revision to 24a02fa5ee681840cdc842c22f4cb4bdd5ec3115 for beta release 2.13.0-0.2.pre'

* Update release-candidate-branch.version

Co-authored-by: Jason Simmons <[email protected]>
Co-authored-by: Darren Austin <[email protected]>
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. cp: approved Approved cherry-pick request cp: review Cherry-picks in the review queue d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New buttons should use InkSparkle for splashFactory when useMaterial3 is true Update common buttons to support Material 3

6 participants