-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
BottomSheet v3 #79
Merged
Merged
BottomSheet v3 #79
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was
linked to
issues
Jul 4, 2022
This reverts commit 663e698.
This reverts commit 4a5e4cc.
thanks to https://gist.github.com/jfuellert/67e91df63394d7c9b713419ed8e2beb7 i borrowed all layout code form there :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The goals
I have been recoding the project to achieve
ViewModifiers
First I dropped the
options: [BottomSheet.Options]
parameter and instead switched to ViewModifiers. For example:I think the concept is pretty self explanatory and after the readme is updated with a full list of modifiers all question regarding this should be resolved.
BottomSheetPosition
I also tried to make the BottomSheetPosition easier to use and to implement new features; instead of subclassing I switched to a predefined enum that represents all different possibilities:
New cases explanation
...Bottom
represents the state where the main content is hidden and...Top
the state where the BottomSheet can be scrolled when using.enableAppleScrollBehaviour(true)
.The last new option is
dynamic...
which represents the state where the sheet has a "dynamic" height / wraps its content height.Consequences
However this new BottomSheetPosition requires you to tell the BottomSheet which positions can be switched out / into (for example by swiping down/up or tapping the tap indicator). Therefore I added a
switchablePositions: [BottomSheetPosition]
parameter, where you can declare the cases you want to have. For example:As you may realize, this looks very similar to the BottomSheetPosition enum in v2. Converting to it should therefore be easy.
Pros and Cons
Pros of the new implementation:
...Bottom
positions from the rest (Wrong scrollView content position with custom sheet positions #78 MainContent not displayed if there are less than 3 bottom sheet positions #73 Swiping on mainContent dismisses it… Without dismissing the sheet. #72)Cons of the new implementation:
switchablePositions: [BottomSheetPosition]
makes it not clearer or easier to useWhat do you think?
It would be nice if you could provide feedback regarding this questions.
Other new features
onAppear
only called once #65About macOS and iPad support
appleScrollBehaviour
on iPad and Mac now 'only' packs the view inside of a basic ScrollView. Why?Because the sheet is "up side down" so you are pulling it down. And it is in the top left not on the bottom. Therefore the
appleScrollBehaviour
behaviour of the iPhone doesn't make sense.