Skip to content

Implements focus handling and hover for Material buttons. - #31438

Merged
gspencergoog merged 2 commits into
flutter:masterfrom
gspencergoog:material_focus
May 15, 2019
Merged

gspencergoog merged 2 commits into
flutter:masterfrom
gspencergoog:material_focus

Conversation

@gspencergoog

@gspencergoog gspencergoog commented Apr 22, 2019 •

Copy link
Copy Markdown
Contributor

Description

This implements focus and hover handling for Material buttons. It inserts Focus widgets into the tree in order to allow buttons to be focusable via keyboard traversal (a.k.a. TAB traversal), and Listener widgets into the InkWell to allow the detection of hover states for widgets.

Related Issues

Addresses #11344, #1608, and #13264.

Tests

I added the following tests:

  • Tests for InkWell
  • Tests for MaterialButton
  • Tests for OutlineButton, RaisedButton, and FlatButton

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

@gspencergoog
gspencergoog force-pushed the material_focus branch 3 times, most recently from e67ec2c to fa09183 Compare April 26, 2019 21:09
@goderbauer goderbauer added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Apr 29, 2019
@gspencergoog
gspencergoog force-pushed the material_focus branch 14 times, most recently from eb248be to 570209c Compare May 7, 2019 00:27
@gspencergoog
gspencergoog force-pushed the material_focus branch 10 times, most recently from 9984dd2 to 7cfcf63 Compare May 10, 2019 03:32
@gspencergoog
gspencergoog marked this pull request as ready for review May 10, 2019 04:30
@gspencergoog
gspencergoog requested a review from darrenaustin May 10, 2019 04:30
@gspencergoog
gspencergoog force-pushed the material_focus branch 2 times, most recently from 249b5b7 to 5e6c90c Compare May 10, 2019 15:58

@darrenaustin darrenaustin 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.

Some minor comments and questions aside, LGTM.

Comment thread packages/flutter/lib/src/material/bottom_navigation_bar.dart Outdated
Comment thread packages/flutter/lib/src/material/button.dart Outdated
Comment thread packages/flutter/lib/src/material/button.dart Outdated
Comment thread packages/flutter/lib/src/material/button.dart Outdated
Comment thread packages/flutter/lib/src/material/button_theme.dart Outdated
Comment thread packages/flutter/test/material/floating_action_button_test.dart Outdated
Comment thread packages/flutter/test/material/ink_well_test.dart Outdated
Comment thread packages/flutter/test/material/outline_button_test.dart Outdated

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.

What was the reason for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because the hover support adds another frame to the animation.

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.

Why was this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, it doesn't need to be removed. For a while I had a bug (but didn't know it) that had the hover animation still running here. It's fixed now.

@gspencergoog
gspencergoog force-pushed the material_focus branch 2 times, most recently from 7c85947 to 5ce66cb Compare May 11, 2019 01:47
@gspencergoog gspencergoog changed the title Implements focus handling for Material buttons. Implements focus handling and hover for Material buttons. May 11, 2019
@flutter flutter deleted a comment from googlebot May 14, 2019
@flutter flutter deleted a comment from googlebot May 14, 2019
@gspencergoog
gspencergoog force-pushed the material_focus branch 5 times, most recently from ed049c5 to 3cc0401 Compare May 14, 2019 19:43
@gspencergoog
gspencergoog merged commit bb3c660 into flutter:master May 15, 2019
@gspencergoog
gspencergoog deleted the material_focus branch May 15, 2019 16:29
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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.

4 participants