本文介绍Flutter中的滑块组件
-
Slider:只有一个滑块,获取滑动后位置的值
-
RangeSlider:有两个滑块,左右滑动后,获取区间的值
-
CupertinoSlider:仿IOS风格的滑块
2.1 构造方法
const Slider({
Key? key,
required this.value,
required this.onChanged,
this.onChangeStart,
this.onChangeEnd,
this.min = 0.0,
this.max = 1.0,
this.divisions,
this.label,
this.activeColor,
this.inactiveColor,
this.mouseCursor,
this.semanticFormatterCallback,
this.focusNode,
this.autofocus = false,
})
2.2 常用属性
| 属性 | 说明 | 取值 |
| :-: | :-: | :-: |
| value | 滑块在此位置的取值 | double |
| onChanged | 滑块位置变化回调函数 | ValueChang