Skip to content

fix(bottom_sheet): fix dismissal near minimum extent when shouldCloseOnMinExtent- #190705 - #190810

Closed
kirya355 wants to merge 1 commit into
flutter:masterfrom
kirya355:master
Closed

fix(bottom_sheet): fix dismissal near minimum extent when shouldCloseOnMinExtent- #190705#190810
kirya355 wants to merge 1 commit into
flutter:masterfrom
kirya355:master

Conversation

@kirya355

@kirya355 kirya355 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

I saw material is freezed but after this answer I reopened PR
flutter/packages#12392 (comment)

Fixes bottom sheet dismissal when a DraggableScrollableNotification extent
is within floating-point precision of minExtent, rather than exactly equal.

Updates both BottomSheet and Scaffold notification handlers and adds
regression tests for modal and standard bottom sheets using
extent: 0.20000000001 with minExtent: 0.2.

Tests

  • bin/flutter test packages/flutter/test/material/bottom_sheet_test.dart

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • 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].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Aug 9, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the bottom sheet closing logic in bottom_sheet.dart and scaffold.dart to use precisionErrorTolerance when comparing the current extent to the minimum extent, and adds corresponding tests. The review feedback suggests that using absolute difference (.abs() < precisionErrorTolerance) may fail to close the bottom sheet if the extent drops below the minimum, and recommends using notification.extent - notification.minExtent <= precisionErrorTolerance to safely handle both nearly-equal and less-than cases.

Comment thread packages/flutter/lib/src/material/bottom_sheet.dart
Comment thread packages/flutter/lib/src/material/scaffold.dart
@dkwingsmt
dkwingsmt requested a review from QuncCccccc August 12, 2026 18:17
@QuncCccccc

Copy link
Copy Markdown
Contributor

Hi @kirya355! Thanks a lot for your contribution! This is a change that should be made in flutter/packages in the new material_ui package.
There are some helpful instructions on how to move the PR over in #188444
Let us know if you need any help. :)

@kirya355

Copy link
Copy Markdown
Contributor Author

Closed cause created port in flutter/packages here
flutter/packages#12545

@kirya355 kirya355 closed this Aug 22, 2026
@kirya355

Copy link
Copy Markdown
Contributor Author

Hi @kirya355! Thanks a lot for your contribution! This is a change that should be made in flutter/packages in the new material_ui package. There are some helpful instructions on how to move the PR over in #188444 Let us know if you need any help. :)

Hi @QuncCccccc ! Thanks for the guidance.
I previously opened a PR in flutter/packages (#190810), but it was closed after this comment.
I hope the port from my new PR will help. If not, I’d really appreciate any help with moving it to the new material_ui package.
Here is the new PR: flutter/packages#12545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

2 participants