Skip to content

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

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

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. f: material design flutter/packages/flutter/material repository. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

1 participant