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: Closing bottom sheet and removing FAB cause assertion failure #128566

Merged
merged 5 commits into from Jun 22, 2023

Conversation

utisam
Copy link
Contributor

@utisam utisam commented Jun 9, 2023

Fixes #128562

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 f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jun 9, 2023
@utisam utisam marked this pull request as ready for review June 9, 2023 08:14
@TahaTesser TahaTesser self-requested a review June 9, 2023 10:12
@TahaTesser
Copy link
Member

Thanks for fixing this! @utisam

We'll need a test for this fix.

@utisam
Copy link
Contributor Author

utisam commented Jun 9, 2023

@TahaTesser Test was added at 02404bc

The assertion failure was caused on the latest master channel.

Comment on lines 2832 to 2838
setState(() => show = false);

await tester.pump(); // start animation
await tester.pump(const Duration(seconds: 1));

expect(controller?.closed, completes);
expect(find.byType(FloatingActionButton), findsNothing);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not really sure if this is the correct way to test this.

When I comment on these lines and just let pumpWidget, I get errors.

    // setState(() => show = false);

    // await tester.pump(); // start animation
    // await tester.pump(const Duration(seconds: 1));

    // expect(controller?.closed, completes);
    // expect(find.byType(FloatingActionButton), findsNothing);

return MaterialApp(
home: Scaffold(
body: Builder(builder: (BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {
Copy link
Member

Choose a reason for hiding this comment

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

Is addPostFrameCallback necessary?
It'd be preferable to add and remove the bottom sheet by pressing buttons.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, maybe can the FAB.onPressed trigger this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments. I rewrite the test using buttons.

Yeah, maybe can the FAB.onPressed trigger this change?

I also tried to trigger 2 changes at FAB.onPressed at once, but it does not reproduce the assertion error.

While rewriting the test, I found the problem is only that while the hiding FAB animation is running, another event starts the closing bottom animation. The reversed order (close bottom sheet → hide FAB) or both at once does not.

@TahaTesser
Copy link
Member

@Piinks
This seems to be a risky change and test. Do you know anyone who has expertise in this area to review this PR?

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.

Thanks for raising this @TahaTesser. Welcome @utisam! Thanks for contributing!
Can you take a look at the test suggestion below? It may be that we just need a bit more context to understand the design of the test - thank you for including one by the way. :)

Copy link
Member

@TahaTesser TahaTesser left a comment

Choose a reason for hiding this comment

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

LGTM

@TahaTesser TahaTesser requested a review from Piinks June 19, 2023 07:19
@TahaTesser
Copy link
Member

We'll need a second review from @Piinks before landing this.

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.

Just a couple of style guide nits from me, which I was able to just tweak here on github. Thanks again for contributing @utisam! LGTM!

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 21, 2023

auto label is removed for flutter/flutter, pr: 128566, due to - The status or check suite Linux flutter_plugins has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2023
@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 22, 2023
@auto-submit auto-submit bot merged commit 0da8012 into flutter:master Jun 22, 2023
71 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 22, 2023
flutter/flutter@c40baf4...042c036

2023-06-22 ahmedelsaayid@gmail.com Remove unnecessary variable `_hasPrimaryFocus` (flutter/flutter#129066)
2023-06-22 tessertaha@gmail.com Fix Material 3 Scrollable `TabBar` (flutter/flutter#125974)
2023-06-22 utisam@gmail.com Fix: Closing bottom sheet and removing FAB cause assertion failure (flutter/flutter#128566)
2023-06-22 tessertaha@gmail.com Add `InputDecorationTheme.merge` (flutter/flutter#129011)
2023-06-22 engine-flutter-autoroll@skia.org Roll Packages from 9af50d4 to 95bc1c6 (6 revisions) (flutter/flutter#129351)
2023-06-22 42216813+eliasyishak@users.noreply.github.com Prevent crashes on range errors when selecting device (flutter/flutter#129290)
2023-06-22 zanderso@users.noreply.github.com Revert "Roll Flutter Engine from 703c9a14ac7f to 8cc6d6d5efdb (1 revision)" (flutter/flutter#129353)
2023-06-22 engine-flutter-autoroll@skia.org Roll Flutter Engine from 703c9a14ac7f to 8cc6d6d5efdb (1 revision) (flutter/flutter#129339)
2023-06-22 engine-flutter-autoroll@skia.org Roll Flutter Engine from d9530e2b87de to 703c9a14ac7f (1 revision) (flutter/flutter#129337)
2023-06-22 engine-flutter-autoroll@skia.org Roll Flutter Engine from c6251a69a09a to d9530e2b87de (1 revision) (flutter/flutter#129334)
2023-06-22 engine-flutter-autoroll@skia.org Roll Flutter Engine from 08aaa88bf67f to c6251a69a09a (10 revisions) (flutter/flutter#129331)
2023-06-22 jason-simmons@users.noreply.github.com Manual roll of packages to 9af50d4 (flutter/flutter#129328)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 090fae83548a to 08aaa88bf67f (3 revisions) (flutter/flutter#129306)
2023-06-21 yjbanov@google.com [framework,web] add FlutterTimeline and semantics benchmarks that use it (flutter/flutter#128366)
2023-06-21 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#128966)
2023-06-21 6655696+guidezpl@users.noreply.github.com Remove incorrect non-nullable assumption from `ShapeDecoration.lerp` (flutter/flutter#129298)
2023-06-21 jmccandless@google.com Gracefully handle negative position in getWordAtOffset (flutter/flutter#128464)
2023-06-21 christopherfujino@gmail.com [flutter_tools] add a gradle error handler for could not open cache directory (flutter/flutter#129222)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from f973fb4636d3 to 090fae83548a (5 revisions) (flutter/flutter#129293)
2023-06-21 rmolivares@renzo-olivares.dev Selection area right click behavior should match native (flutter/flutter#128224)

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 dit@google.com,rmistry@google.com,stuartmorgan@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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing bottom sheet and removing FAB cause assertion failure
3 participants