fix: arbitrarily disposes of the passed controller #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for providing an excellent package.
An unexpected behavior occurred during use, and I am writing a PR because I would like to contribute to a better package.
Checklist
fix
,close
,resolve
etc. if necessary)Changes
Current:
For
DraggableScrollableController
, it is implemented to dispose the controller unconditionally when disposing without distinguishing between the controller created in FlexibleBottomSheet and the controller passed as a parameter.Change:
In the case of
DraggableScrollableController
passed as a parameter from the outside, change it not to be disposed so that it can be managed by itself from the outside.What is the current behavior, and the steps to reproduce the issue?
In general, in the case of a controller passed to a widget or function, create/dispose is carried out by the entity that passed it. (ex. TextEditingController passed to TextField, ScrollController passed to ScrollView.)
However, FlexibleBottomSheet internally disposes the DraggableScrollableController passed as a parameter from the outside.
This causes confusion and an exception occurs in the code below.
What is the expected behavior?
No exception occurs.
How does this PR fix the problem?
DraggableScrollableController passed as a parameter from outside is not disposed in FlexibleBottomSheet.
With this change, the controller can manage itself externally,
and no exception is thrown when closing the bottomsheet in the code above.