Skip to content

Conversation

@pennzht
Copy link
Member

@pennzht pennzht commented Oct 15, 2019

Description

This PR fixes the "Chip Ripple" bug:

  • The existing behavior: When you create a filter chip with a delete icon, you see two ripples when you tap and hold the delete icon: one for the delete icon, and another for the entire chip.
  • New behavior: There is only a ripple for the delete icon when you tap and hold the delete icon, and only a ripple for the entire chip if you tap anywhere else on the chip.

Related Issues

b/140930220

Tests

I added the following tests:

  • Chip creates centered, unique ripple when label is tapped.
  • Delete button creates non-centered, unique ripple when tapped.
    • Tapping the delete button creates a different ripple.
    • Tapping the delete button does NOT create two different ripples.
  • RTL delete button responds to tap on the left of the chip.
    • Chip correctly supports right-to-left text direction.
  • Chip without delete button creates correct ripple.
    • Chip without a delete button will create the same ripple throughout the chip.

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 ///).
    • This is a bugfix. Documentation is not edited.
  • 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?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Oct 15, 2019
@pennzht pennzht changed the title Fix chip ripple reconcile master Fix chip ripple bug — No longer two ripples Oct 15, 2019
@pennzht pennzht requested a review from rami-a October 15, 2019 19:13
TextDirection textDirection = TextDirection.ltr,
}){
return _wrapForChip(
child: Wrap(
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the need for the Wrap widget? Can you remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@rami-a @HansMuller @gspencergoog

I used a Wrap because some existing tests also used it, even when it has only one child.
It seems that in other tests of chip_test.dart, the Chip widget is always wrapped in some other widget, such as Wrap, Column, Row, or Center.
Does anyone know the reason behind this practice?

The ripple behaves differently when not wrapped in a Wrap widget (but it always makes exactly one ripple).

Copy link
Contributor

Choose a reason for hiding this comment

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

One use case for the Chip is to be inside of a Wrap field that also allows entering text. Think of the "To:" field in GMail: you type addresses, and they convert to wrapped chips.

That's why I used initially Wrap in tests so that we can be sure that the Chip behaves properly in that context.

Copy link
Contributor

@rami-a rami-a left a comment

Choose a reason for hiding this comment

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

██╗      ██████╗ ████████╗███╗   ███╗
██║     ██╔════╝ ╚══██╔══╝████╗ ████║
██║     ██║  ███╗   ██║   ██╔████╔██║
██║     ██║   ██║   ██║   ██║╚██╔╝██║
███████╗╚██████╔╝   ██║   ██║ ╚═╝ ██║
╚══════╝ ╚═════╝    ╚═╝   ╚═╝     ╚═╝

@pennzht pennzht requested a review from clocksmith October 16, 2019 16:43
@pennzht pennzht requested a review from gspencergoog October 16, 2019 16:44
@pennzht pennzht requested a review from johnsonmh October 18, 2019 16:20
Copy link
Contributor

@johnsonmh johnsonmh left a comment

Choose a reason for hiding this comment

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

██╗      ██████╗ ████████╗███╗   ███╗
██║     ██╔════╝ ╚══██╔══╝████╗ ████║
██║     ██║  ███╗   ██║   ██╔████╔██║
██║     ██║   ██║   ██║   ██║╚██╔╝██║
███████╗╚██████╔╝   ██║   ██║ ╚═╝ ██║
╚══════╝ ╚═════╝    ╚═╝   ╚═╝     ╚═╝

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

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@pennzht pennzht merged commit 320a933 into flutter:master Oct 23, 2019
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
* Fixed chip ripple.

* Fixed chip ripple. All tests passed.

* Fix one minor detail.

* Fixed reference box.

* Playing around 2.

* Added tests for chip ripple.

* Reverting print-debugging statements

* Remove extra blank line.

* Fixed chip ripple.

* Remove commented code.

* Reconciles with upstream/master.

* Remove print-debugging statement.

* Remove empty line.

* Edit comments.

* Edit style and comments.

* Edit style.

* Fix style and capitalization.

* Return bool.

* Edit style.

* Use getMaterialBox instead of Material.of(...).

* Experiment 3.

* Revert.

* Using tester.pump instead of pumpFrames

* Delete pumpFrames.

* Edit comments.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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.

8 participants