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

Fix chips onDeleted callback don't show the delete button when disabled #137685

Merged
merged 3 commits into from Nov 29, 2023

Conversation

TahaTesser
Copy link
Member

fixes Chips with onDeleted callback should show the delete button in the disabled state

Code sample

expand to view the code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

class Example extends StatefulWidget {
  const Example({super.key});

  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            RawChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('RawChip'),
              onSelected: null,
              isEnabled: false,
              onDeleted: () {},
            ),
            InputChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('InputChip'),
              isEnabled: false,
              onPressed: null,
              onDeleted: () {},
            ),
            FilterChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              onSelected: null,
              onDeleted: () {},
            ),
          ],
        ),
      ),
    );
  }
}
Before After

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. labels Nov 1, 2023
@TahaTesser TahaTesser marked this pull request as ready for review November 2, 2023 08:58
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha 820f38fe8bfbbf37a15653354eb91a709f43e1ef

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Nov 2, 2023
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 - there are quite a few golden file changes; please check to see that they're all valid.

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha af3b0d48b544abb1fca652f1d731433c18080514

@TahaTesser TahaTesser force-pushed the disabled_chip_delete_button branch 2 times, most recently from feb1929 to bd5dcd7 Compare November 6, 2023 13:44
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha bd5dcd7

@TahaTesser
Copy link
Member Author

Blocked by #138009

@TahaTesser TahaTesser added blocked Issue is blocked by another issue and removed blocked Issue is blocked by another issue labels Nov 10, 2023
@Piinks
Copy link
Contributor

Piinks commented Nov 13, 2023

I don't know that this is blocked by #138009, @TahaTesser can you share more context? I think that issue can be fixed before or after this one lands.

@TahaTesser
Copy link
Member Author

TahaTesser commented Nov 14, 2023

I don't know that this is blocked by #138009, @TahaTesser can you share more context? I think that issue can be fixed before or after this one lands.

Chip with a delete button isn't rendered properly when disabled in the canvaskit renderer after #136918
Unfortunately, this PR is also testing Chip with a delete button in the disabled state.

We will need to be able to test the chip in canvaskit renderer

@TahaTesser
Copy link
Member Author

TahaTesser commented Nov 17, 2023

Waiting for flutter/engine#48142 to roll into framework

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha a717230

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha a1c8c28

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137685 at sha 4329405

@TahaTesser
Copy link
Member Author

TahaTesser commented Nov 20, 2023

Rebased to get engine fix flutter/engine#48142

Pushed an empty to get updated golden files and approved the golden files.

@TahaTesser TahaTesser force-pushed the disabled_chip_delete_button branch 2 times, most recently from d65dbcc to a8a2a5b Compare November 21, 2023 09:05
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

It looks like there is a merge conflict here. I checked the Google testing failure, and it looks unrelated, but a rebase with the merge being resolved would help confirming that. :)

@TahaTesser
Copy link
Member Author

TahaTesser commented Nov 22, 2023

It looks like there is a merge conflict here.

It's actually a conflict from my own PR #138287 😂

I checked the Google testing failure, and it looks unrelated

It was failing before the conflict. Let me resolve the conflict and try again.

@TahaTesser TahaTesser force-pushed the disabled_chip_delete_button branch 3 times, most recently from 8af5539 to 57188f2 Compare November 28, 2023 14:07
@TahaTesser
Copy link
Member Author

@Piinks
After multiple tries, this is finally green. Is it safe to merge?

@TahaTesser
Copy link
Member Author

Pushed an empty to make sure all is good.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

I checked the goldens, and they should be good to go. I'll keep an eye on when this lands though just in case there is an issue. :)

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 29, 2023
@auto-submit auto-submit bot merged commit 4648f54 into flutter:master Nov 29, 2023
70 checks passed
@TahaTesser TahaTesser deleted the disabled_chip_delete_button branch November 30, 2023 08:26
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 30, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 30, 2023
flutter/flutter@5e5b529...918e336

2023-11-30 zanderso@users.noreply.github.com Move Impeller tests on Pixel 7 Pro from staging to prod (flutter/flutter#139280)
2023-11-30 xubaolin@oppo.com Introduce multi-touch drag strategies for `DragGestureRecognizer` (flutter/flutter#136708)
2023-11-30 godofredoc@google.com Use the correct recipe on fuchsia_precache. (flutter/flutter#139279)
2023-11-30 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Migration for the `sendTiming` events for `package:unified_analytics`" (flutter/flutter#139278)
2023-11-30 godofredoc@google.com Migrate fuchsia_precache to shard tests. (flutter/flutter#139202)
2023-11-29 tessertaha@gmail.com Fix chips `onDeleted` callback don't show the delete button when disabled (flutter/flutter#137685)
2023-11-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9a7e49d75411 to 35939ca8534f (5 revisions) (flutter/flutter#139259)
2023-11-29 58190796+MitchellGoodwin@users.noreply.github.com Refactor to use Apple system fonts (flutter/flutter#137275)
2023-11-29 goderbauer@google.com Dynamic view sizing (flutter/flutter#138648)
2023-11-29 ian@hixie.ch Roll dependencies (flutter/flutter#139203)
2023-11-29 92773903+yakagami@users.noreply.github.com add sourceTimeStamp to ScaleUpdateDetails (flutter/flutter#135936)
2023-11-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 222beb28a8eb to 9a7e49d75411 (1 revision) (flutter/flutter#139250)
2023-11-29 gspencergoog@users.noreply.github.com Remove deprecated `PlatformMenuBar.body` (flutter/flutter#138509)
2023-11-29 42216813+eliasyishak@users.noreply.github.com Migration for the `sendTiming` events for `package:unified_analytics` (flutter/flutter#138896)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
…r#5526)

flutter/flutter@5e5b529...918e336

2023-11-30 zanderso@users.noreply.github.com Move Impeller tests on Pixel 7 Pro from staging to prod (flutter/flutter#139280)
2023-11-30 xubaolin@oppo.com Introduce multi-touch drag strategies for `DragGestureRecognizer` (flutter/flutter#136708)
2023-11-30 godofredoc@google.com Use the correct recipe on fuchsia_precache. (flutter/flutter#139279)
2023-11-30 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Migration for the `sendTiming` events for `package:unified_analytics`" (flutter/flutter#139278)
2023-11-30 godofredoc@google.com Migrate fuchsia_precache to shard tests. (flutter/flutter#139202)
2023-11-29 tessertaha@gmail.com Fix chips `onDeleted` callback don't show the delete button when disabled (flutter/flutter#137685)
2023-11-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9a7e49d75411 to 35939ca8534f (5 revisions) (flutter/flutter#139259)
2023-11-29 58190796+MitchellGoodwin@users.noreply.github.com Refactor to use Apple system fonts (flutter/flutter#137275)
2023-11-29 goderbauer@google.com Dynamic view sizing (flutter/flutter#138648)
2023-11-29 ian@hixie.ch Roll dependencies (flutter/flutter#139203)
2023-11-29 92773903+yakagami@users.noreply.github.com add sourceTimeStamp to ScaleUpdateDetails (flutter/flutter#135936)
2023-11-29 engine-flutter-autoroll@skia.org Roll Flutter Engine from 222beb28a8eb to 9a7e49d75411 (1 revision) (flutter/flutter#139250)
2023-11-29 gspencergoog@users.noreply.github.com Remove deprecated `PlatformMenuBar.body` (flutter/flutter#138509)
2023-11-29 42216813+eliasyishak@users.noreply.github.com Migration for the `sendTiming` events for `package:unified_analytics` (flutter/flutter#138896)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
caseycrogers pushed a commit to caseycrogers/flutter that referenced this pull request Dec 29, 2023
…bled (flutter#137685)

fixes [Chips with `onDeleted` callback should show the delete button in the `disabled` state](flutter#136638)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @OverRide
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

class Example extends StatefulWidget {
  const Example({super.key});

  @OverRide
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {

  @OverRide
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            RawChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('RawChip'),
              onSelected: null,
              isEnabled: false,
              onDeleted: () {},
            ),
            InputChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('InputChip'),
              isEnabled: false,
              onPressed: null,
              onDeleted: () {},
            ),
            FilterChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              onSelected: null,
              onDeleted: () {},
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/8bd458de-cfd2-44f0-a0dd-a8298938c61f" /> | <img src="https://github.com/flutter/flutter/assets/48603081/afca0684-b061-416b-b029-5316588c6888" /> |
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chips with onDeleted callback should show the delete button in the disabled state
3 participants