-
Notifications
You must be signed in to change notification settings - Fork 46
/
main.dart
91 lines (86 loc) · 2.33 KB
/
main.dart
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import 'package:flutter/material.dart';
import 'package:flutter_fluid_slider/flutter_fluid_slider.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
HomePageState createState() {
return new HomePageState();
}
}
class HomePageState extends State<HomePage> {
double _value1 = 0.0;
double _value2 = 10.0;
double _value3 = 1.0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
FluidSlider(
value: _value1,
onChanged: (double newValue) {
setState(() {
_value1 = newValue;
});
},
min: 0.0,
max: 100.0,
),
SizedBox(
height: 100.0,
),
FluidSlider(
value: _value2,
onChanged: (double newValue) {
setState(() {
_value2 = newValue;
});
},
min: 0.0,
max: 500.0,
sliderColor: Colors.redAccent,
thumbColor: Colors.amber,
start: Icon(
Icons.money_off,
color: Colors.white,
),
end: Icon(
Icons.attach_money,
color: Colors.white,
),
),
SizedBox(
height: 100.0,
),
FluidSlider(
value: _value3,
sliderColor: Colors.purple,
onChanged: (double newValue) {
setState(() {
_value3 = newValue;
});
},
min: 1.0,
max: 5.0,
mapValueToString: (double value) {
List<String> romanNumerals = ['I', 'II', 'III', 'IV', 'V'];
return romanNumerals[value.toInt() - 1];
}),
],
),
),
);
}
}