/
main.dart
208 lines (203 loc) · 7.23 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import 'package:flutter/material.dart';
import 'package:rulers/rulers.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
textTheme: TextTheme(
headline3: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20))),
home: Demo(),
);
}
}
class Demo extends StatefulWidget {
@override
_DemoState createState() => _DemoState();
}
/*
As for Example only here
* Limit is 24 as time in hours
* interval 3 as 15,30,45 min
*
*
* */
class _DemoState extends State<Demo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Rulers Example'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Normal Scale',
style: Theme.of(context).textTheme.headline3,
),
Container(
margin: const EdgeInsets.only(top: 8.0),
child: RulerWidget(
height: 100,
scaleBackgroundColor: Colors.grey.shade200,
largeScaleBarsInterval: 24,
smallScaleBarsInterval: 3,
barsColor: Colors.grey,
indicatorWidget: Column(
children: <Widget>[
Icon(
Icons.arrow_drop_down,
color: Colors.red,
),
],
),
),
),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
'In and Out Range Scale',
style: Theme.of(context).textTheme.headline3,
),
),
Container(
margin: const EdgeInsets.only(top: 8.0),
child: RulerWidget(
height: 100,
scaleBackgroundColor: Colors.grey.shade100,
indicatorWidget: Column(
children: const <Widget>[
Icon(
Icons.arrow_drop_down,
color: Colors.red,
),
],
),
largeScaleBarsInterval: 24,
smallScaleBarsInterval: 3,
lowerIndicatorLimit: 2,
lowerMidIndicatorLimit: 2,
upperMidIndicatorLimit: 6,
upperIndicatorLimit: 6,
barsColor: Colors.grey,
inRangeBarColor: Colors.green,
behindRangeBarColor: Colors.orangeAccent,
outRangeBarColor: Colors.red,
),
),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
'In,Out,Mid Range Scale',
style: Theme.of(context).textTheme.headline3,
),
),
Container(
margin: const EdgeInsets.only(top: 8.0),
child: RulerWidget(
height: 100,
scaleBackgroundColor: Colors.yellow,
indicatorWidget: Column(
children: const <Widget>[
Icon(
Icons.arrow_drop_down,
color: Colors.red,
),
],
),
largeScaleBarsInterval: 24,
smallScaleBarsInterval: 3,
lowerIndicatorLimit: 2,
lowerMidIndicatorLimit: 4,
upperMidIndicatorLimit: 7,
upperIndicatorLimit: 8,
barsColor: Colors.grey,
inRangeBarColor: Colors.green,
behindRangeBarColor: Colors.orangeAccent,
outRangeBarColor: Colors.red,
),
),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
'Custom Marker Scale',
style: Theme.of(context).textTheme.headline3,
),
),
Container(
margin: const EdgeInsets.only(top: 8.0),
child: RulerWidget(
height: 100,
scaleBackgroundColor: Colors.blue.shade100,
indicatorWidget: Image.asset(
'assets/marker.png',
color: Colors.red,
height: 25,
width: 25,
),
largeScaleBarsInterval: 24,
smallScaleBarsInterval: 3,
lowerIndicatorLimit: 2,
lowerMidIndicatorLimit: 2,
upperMidIndicatorLimit: 7,
upperIndicatorLimit: 7,
barsColor: Colors.grey,
inRangeBarColor: Colors.green,
behindRangeBarColor: Colors.orangeAccent,
outRangeBarColor: Colors.red,
),
),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
'Horizontal Scale',
style: Theme.of(context).textTheme.headline3,
),
),
Container(
margin: const EdgeInsets.only(top: 8.0),
alignment: Alignment.centerLeft,
child: RulerWidget(
scaleBackgroundColor: Colors.grey.shade100,
height: 100,
indicatorWidget: Column(
children: <Widget>[
Icon(
Icons.arrow_drop_down,
color: Colors.red,
),
],
),
largeScaleBarsInterval: 20,
smallScaleBarsInterval: 4,
lowerIndicatorLimit: 0,
lowerMidIndicatorLimit: 0,
upperMidIndicatorLimit: 0,
upperIndicatorLimit: 0,
barsColor: Colors.grey,
inRangeBarColor: Colors.green,
behindRangeBarColor: Colors.orangeAccent,
outRangeBarColor: Colors.red,
axis: Axis.vertical,
),
),
],
),
),
),
),
);
}
}