/
main.dart
81 lines (77 loc) · 2.25 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
import 'package:flutter/material.dart';
import 'package:horizontal_picker/horizontal_picker.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Horizontal Picker',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.grey,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
double? newValue;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
HorizontalPicker(
minValue: 0,
maxValue: 10,
divisions: 10,
height: 120,
onChanged: (value) {},
),
Divider(),
HorizontalPicker(
minValue: 0,
maxValue: 10,
divisions: 10,
height: 120,
suffix: " \u00b0C",
showCursor: false,
backgroundColor: Colors.lightBlue.shade50,
activeItemTextColor: Colors.blue.shade800,
passiveItemsTextColor: Colors.blue.shade300,
onChanged: (value) {},
),
Divider(),
HorizontalPicker(
minValue: -10,
maxValue: 55,
divisions: 600,
height: 120,
suffix: " cm",
showCursor: false,
backgroundColor: Colors.grey.shade900,
activeItemTextColor: Colors.white,
passiveItemsTextColor: Colors.amber,
onChanged: (value) {
setState(() {
newValue = value;
});
},
),
Text(newValue.toString())
],
),
),
),
);
}
}