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
Additional builder parameters #40
Conversation
@MaddinMade
Isn't it just one additional widget? The widget which has stack number '-1' is for preparing to rewind. (If no preparing, the rewinding cannot provide production quality.)
I've not used I guess we could fix the following code which uses
|
@HeavenOSK Thanks for the quick reply :)
You're right, the additional widgets are no valid reasons for this pull request. I had admittedly misunderstood how this package worked as you can see in the following code: flutter_swipable_stack/example/lib/examples/basic_example.dart Lines 65 to 66 in 390572d
For example, if you want to apply a blur effect, you can use In general, however, my goal with this pull request was not to solve a specific problem. I rather wanted to make the package more flexible. Another use case for this is that you could change the background color of a card in the stack depending on the swipe progress. Currently, for such cases, you would have to build the whole card in the overlay and then make the changes on it. I hope I didn't babble too much and you can unterstand my goal with this pull request.
Using opacity with 0 and 1 is not inefficient, as far as I know. It only becomes so once you use other numbers with it. |
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.
@MaddinMade
Thanks for committing & conversation!
Your change makes sense to me. But I found a few points that could be made better, so it would be great if you could fix them.
Thanks.
@HeavenOSK |
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 your contribution! This change looks perfect to me & it's wonderful beyond my imagination.
You should double check that I am still passing the correct values to the builders.
I checked your point and it seems to be OK! Thank you so much 🙏
abstract class SwipeProperties { | ||
const SwipeProperties({ | ||
required this.index, | ||
required this.constraints, | ||
required this.direction, | ||
required this.swipeProgress, | ||
}); | ||
|
||
///Index of the current item. | ||
final int index; | ||
|
||
///[Constraints] of the whole stack. | ||
final BoxConstraints constraints; | ||
|
||
///Direction of the current swipe action. | ||
final SwipeDirection? direction; | ||
|
||
///Progress of the current swipe action. | ||
final double swipeProgress; | ||
} |
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.
Nice abstraction! 💯
I'll release changes in this PR as |
@MaddinMade |
@HeavenOSK |
Hello :)
I had the problem with this package that very many widgets were built, although you can not see them anyway. In addition, the overlay had performance problems, since this was above all widgets in the stack and below and not only above the top widget. This led to very poor performance for me with BackdropFilters.
So I modified the package to pass in the builder where in the stack the current widget is and also the data that is passed to the OverlayBuilder. So you have on the one hand the possibility to adjust also lower widgets in the stack depending on the swipe progress, and on the other hand to implement the topmost overlay more efficiently in some situations. In addition, you can now optionally not build the lower widgets more easily, since it is directly passed where they are located in the stack.
The overlayBuilder remains nevertheless further.
The disadvantage of this request are the three parameters that are now additionally passed to the builder.
Apart from this small problem I had, this package is really very well done and I want to commend this work here.