sliding swipe button
a sliding flutter widget, based on the slide to unlock function from multiple devices. heavily customizable and flexible.
installing
add the following to your pubspec.yaml
:
dependencies:
slide_button: ^0.2.8
usage
- install
- use the slidebutton widget anywhere
- ???
- profit
properties
several properties are present and can be customized:
| properties | description |
|------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| height | height of the widget, leave blank to get the parent constraints. |
| backgroundchild | a child to be put on the background bar, not centered by default. |
| slidingchild | a child tobe put on the sliding bar, not centered by default. |
| backgroundcolor | the color of the background bar. |
| slidingbarcolor | the color of the sliding bar. |
| confirmpercentage | how much of the bar width have to be slided to confirm the action. |
| initialsliderpercentage | the initial (and resting) percentage of the sliding bar. |
| isdraggable | is this widget draggable? |
| onbuttonslide | callback that returns a `double` value containing the drag percentage. |
| onbuttonopened | callback called when the button is slided all the way. |
| onbuttonclosed | callback called when the button is back to the initialsliderpercentage. |
| slidedirection | either slidedirection.right or slidedirection.left, sets the sliding direction of the sliding bar. |
| shouldcloseborders | this updates the borders when the button reaches 0.9 percent dragged, and set the borderradius to zero, giving the impression of a "closed" button. defaults to `true` |
| shouldcloseborders | borderradius for the sliding bar, default is 50. |
todo
- [x] create the repo
- [x] make it work
- [ ] fix text on the sliding bar
- [ ] find a better activation function capable of activating between x and y percentages
- [ ] more listeners?
- [ ] parallax effect?
- [ ] make it pop
inspiration
this widget was partially made possible by inspecting elements from sliding_up_panel.
Comments are closed.