enter image description here 我想在flutter项目中添加像这样的图像的范围幻灯片。
答案 0 :(得分:0)
尝试一下:
class ClockRangeWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => _ClockRangeWidget();
}
class _ClockRangeWidget extends State<ClockRangeWidget> {
RangeValues _currentRangeValues = const RangeValues(0, 12);
static String _valueToString(double value) {
return value.toStringAsFixed(0);
}
@override
Widget build(BuildContext context) {
return new Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RangeSlider(
values: _currentRangeValues,
min: 0,
max: 12,
divisions: 11,
labels: RangeLabels(
_currentRangeValues.start.round().toString()+' AM',
_currentRangeValues.end.round().toString()+' AM',
),
onChanged: (RangeValues values) {
setState(() {
_currentRangeValues = values;
});
},
)
],
);
}
}
按以下方式致电:
Container(child:ClockRangeWidget())