-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Add enableDrag property to CupertinoSheetRoute and showCupertinoSheet #163923
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting this PR! Test looks great. Ideally I'd like to keep the buildPageTransitions
method static. It might break some people to change it now, and it seems like we should be able to keep it static.
Besides that, I have some small comments on the documentation.
/// Returns a [CupertinoSheetTransition]. | ||
static Widget buildPageTransitions<T>( | ||
Widget buildPageTransitions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep this as static
if we add an enableDrag argument, then pass it in inside of buildTransitions
. Keeping it static is more likely to help with performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix this commit
9720184
@@ -581,8 +584,13 @@ mixin _CupertinoSheetRouteTransitionMixin<T> on PageRoute<T> { | |||
); | |||
} | |||
|
|||
/// Determines whether the content can be scrolled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: replace "scroll" with "drag". So "can be dragged to dismiss the sheet", "dragging is enabled". Scrolling refers to a slightly different interaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would be better if this was moved above the buildPage
method https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#order-other-class-members-in-a-way-that-makes-sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix this commit
0ebeb39
@@ -1076,5 +1076,74 @@ void main() { | |||
await gesture.up(); | |||
await tester.pumpAndSettle(); | |||
}); | |||
|
|||
testWidgets('dragging does not move the sheet when enableDrag is false', ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 👍
@MitchellGoodwin |
I'm not sure how much additional work it would take to add support for Sheet Detents, which adds to the size support to the sheets (https://developer.apple.com/design/human-interface-guidelines/sheets), in this same PR. |
@KlausJokisuo Therefore, I think PR should be separated. |
In general it's much better if work can be separated into different PRs. So even if it was simple to detents, it would be preferable if that was done in a separate PR. It makes things like documentation and diagnosing tree errors much cleaner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for the PR! Next this needs a second reviewer. I'll ask around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… the sheet can be dragged.(flutter#163852)
d3031ef
to
7a0035c
Compare
Rebased it since Google testing failure was infra related. |
autosubmit label was removed for flutter/flutter/163923, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Implemented. (#163852)
This PR adds the
enableDrag
option to showCupertinoSheet and CupertinoSheetRoute, allowing developers to control whether the sheet can be dismissed by dragging.How to Verify
examples/api/lib/cupertino/sheet/cupertino_sheet.0.dart
after addingenableDrag: false
.2025-02-22.23.10.04.mov
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.