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

[modal_bottom_sheet]: Invalid/unused API's on closeProgressThreshold and preventPopThreshold #409

Open
Juliotati opened this issue Jun 21, 2024 · 0 comments

Comments

@Juliotati
Copy link

After using the package for a while and attempting to have a different value for closeProgressThreshold, I noticed that the value passed in was not being reflected on the behaviour of the bottom sheet. So I dug in and found these.

1.

double? closeProgressThreshold,
@Deprecated('Use preventPopThreshold instead') double? willPopThreshold,
double? preventPopThreshold,
}) : preventPopThreshold =
preventPopThreshold ?? willPopThreshold ?? _willPopThreshold,
closeProgressThreshold =
closeProgressThreshold ?? _closeProgressThreshold;

  • willPopThreshold was deprecated in place of preventPopThreshold
  • preventPopThreshold is never used anywhere in the class state
  • (flingThreshold seems to be a more suitable name)

  • From the docs, it seems like what users are looking is closeProgressThreshold, but that's not true either because that is not the variable that is used to determine whether or not the bottom sheet should close. 👇 (at least from what I noticed, closeProgressThreshold isn't really doing what it entails 😢 )

2.

bool get hasReachedWillPopThreshold =>
widget.animationController.value < _willPopThreshold;

  • From the second snippet above it looks like what should be used here is widget.willPopThreshold and not the hardcoded _willPopThreshold but that doesn't help because the user can't change that anyway.
  • So it would only make sense that closeProgressThreshold replaces willPopThreshold

Let me know if this is all clear to grasp. It does seem all too coupled hence the bug.

@Juliotati Juliotati changed the title Invalid/unused API's on closeProgressThreshold and preventPopThreshold [modal_bottom_sheet]: Invalid/unused API's on closeProgressThreshold and preventPopThreshold Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant