Flutter开发之Slider
本文是关于介绍Slider相关属性的含义。
class SliderThemeData {
/// slider轨道的高度
final double? trackHeight;
/// 滑块滑过的轨道颜色
final Color? activeTrackColor;
/// 滑块未滑过的轨道颜色
final Color? inactiveTrackColor;
/// 滑块滑过的二级轨道颜色
final Color? secondaryActiveTrackColor;
/// 不可选时滑块滑过的轨道颜色
final Color? disabledActiveTrackColor;
/// 不可选时滑块滑过的二级轨道颜色
final Color? disabledSecondaryActiveTrackColor;
/// 不可选时滑块未滑过的轨道颜色
final Color? disabledInactiveTrackColor;
/// 滑块滑过的轨道上刻度的颜色
final Color? activeTickMarkColor;
/// 滑块未滑过的轨道上刻度的颜色
final Color? inactiveTickMarkColor;
/// 不可选时滑块滑过的轨道上刻度的颜色
final Color? disabledActiveTickMarkColor;
/// 不可选时滑块未滑过的轨道上刻度的颜色
final Color? disabledInactiveTickMarkColor;
/// 滑块颜色
final Color? thumbColor;
/// 手指触碰滑块周边颜色
final Color? overlappingShapeStrokeColor;
/// 不可选时滑块颜色
final Color? disabledThumbColor;
/// 滑块按下去滑块周边颜色
final Color? overlayColor;
/// 刻度气泡颜色
final Color? valueIndicatorColor;
/// 滑块按下的形状
final SliderComponentShape? overlayShape;
/// 刻度形状
final SliderTickMarkShape? tickMarkShape;
/// 滑块形状
final SliderComponentShape? thumbShape;
/// 轨道形状
final SliderTrackShape? trackShape;
/// 气泡形状
final SliderComponentShape? valueIndicatorShape;
/// RangeSlider
/// 刻度形状
final RangeSliderTickMarkShape? rangeTickMarkShape;
/// 滑块形状
final RangeSliderThumbShape? rangeThumbShape;
/// 轨道形状
final RangeSliderTrackShape? rangeTrackShape;
/// 气泡形状
final RangeSliderValueIndicatorShape? rangeValueIndicatorShape;
/// 气泡的显示方式
final ShowValueIndicator? showValueIndicator;
/// 气泡文本
final TextStyle? valueIndicatorTextStyle;
/// 最小间隔
final double? minThumbSeparation;
/// 滑块的选择规则
final RangeThumbSelector? thumbSelector;
/// 鼠标光标
final MaterialStateProperty<MouseCursor?>? mouseCursor;
/// 允许滑块与用户的交互方式
final SliderInteraction? allowedInteraction;
}
class Slider {
/// 当前进度
final double value;
/// 二级轨道值
final double? secondaryTrackValue;
/// 进度发生变化
final ValueChanged<double>? onChanged;
final ValueChanged<double>? onChangeStart;
final ValueChanged<double>? onChangeEnd;
/// 最小值
final double min;
/// 最大值
final double max;
/// 分割刻度的个数
final int? divisions;
/// 滑块上方指示器
final String? label;
/// 滑块滑过的轨道颜色
final Color? activeColor;
/// 滑块未滑过的轨道颜色
final Color? inactiveColor;
/// 滑块滑过的二级轨道颜色
final Color? secondaryActiveColor;
/// 滑块颜色
final Color? thumbColor;
/// 滑块按下去的颜色
final MaterialStateProperty<Color?>? overlayColor;
/// 鼠标
final MouseCursor? mouseCursor;
/// 滑块语意值回调
final SemanticFormatterCallback? semanticFormatterCallback;
final FocusNode? focusNode;
final bool autofocus;
/// 允许滑块与用户的交互方式
final SliderInteraction? allowedInteraction;
}
具体使用方式按照含义去使用即可。