-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrangesliderdemo
44 lines (39 loc) · 1007 Bytes
/
rangesliderdemo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Range Slider
//main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
RangeValues values = RangeValues(0, 100);
RangeLabels labels = RangeLabels('0', '100');
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
home: Scaffold(
appBar: AppBar(
title: Text('Material App Bar'),
),
body: Center(
child: RangeSlider(
min: 0,
max: 100,
values: values,
labels: labels,
divisions: 50,
onChanged: (value) {
setState(() {
values = value;
labels =
RangeLabels(value.start.toInt().toString(), value.end.toInt().toString());
});
},
),
),
),
);
}
}