Slider
the Slider const ({ Key Key, @required this.value, // current value @required this.onChanged, // change the callback this.onChangeStart, this.onChangeEnd, this.min = 0.0, this.max = 1.0, this.divisions // how many scale this.label, copy // displayed on the slider this.activeColor, // active area color this.inactiveColor, // inactive area color this.semanticFormatterCallback, // for creating value based on the slide callback semantic value Example: semanticFormatterCallback:. (double newValue) {return '$ {newValue.round ()} dollars}';},
class SliderWidget extends StatefulWidget { SliderWidget({Key key}) : super(key: key); _SliderWidgetState createState() => _SliderWidgetState(); } class _SliderWidgetState extends State<SliderWidget> { double _sliderValue = 0; @override Widget build(BuildContext context) { return Center( child: Slider( value: _sliderValue, onChanged: (double value) { setState(() { this._sliderValue = value; }); }, min: 0, max: 100, divisions: 100, label: '进度:$_sliderValue', activeColor: Colors.red, inactiveColor: Colors.purple, semanticFormatterCallback: (double value) { return '进度:$_sliderValue'; }), ); } }