滑动按钮
一个滑动的 Flutter 小部件,基于多个设备的滑动解锁功能。高度可定制且灵活。

安装
将以下内容添加到你的 pubspec.yaml
dependencies:
slide_button: ^0.2.8
用法
- 安装
- 在任何地方使用 SlideButton 组件
- ???
- 盈利
属性
有几个属性可以自定义
| 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. |
待办事项
- [x] 创建仓库
- [x] 运行起来
- [ ] 修复滑动条上的文本
- [ ] 找到一个更好的激活函数,能够在 x 和 y 百分比之间激活
- [ ] 更多监听器?
- [ ] 视差效果?
- [ ] 让它弹出
灵感
这个组件的部分实现得益于对 sliding_up_panel 的元素检查。