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

Fixed closing bottom sheet during state change #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions sheet/lib/src/route/sheet_route.dart
Expand Up @@ -422,6 +422,7 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer>
void onRouteAnimationUpdate() {
if (_routeController.isCompleted) {
_firstAnimation = false;
_sheetController.position.onFirstAnimationCompleted();
}
if (!_routeController.isAnimating) {
return;
Expand Down
3 changes: 3 additions & 0 deletions sheet/lib/src/scroll_controller.dart
Expand Up @@ -116,6 +116,9 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext {

@override
void goBallistic(double velocity) {

if (!sheetPosition.firstAnimationCompleted) return;

if (sheetPosition.preventingDrag) {
goIdle();
return;
Expand Down
8 changes: 8 additions & 0 deletions sheet/lib/src/sheet.dart
Expand Up @@ -418,6 +418,14 @@ class SheetPosition extends ScrollPositionWithSingleContext {
super.debugLabel,
});

bool get firstAnimationCompleted => _firstAnimationCompleted;

bool _firstAnimationCompleted = false;

void onFirstAnimationCompleted() {
_firstAnimationCompleted = true;
}

late final SheetPrimaryScrollController _scrollController =
SheetPrimaryScrollController(sheetContext: context as SheetContext);

Expand Down