/
main.dart
60 lines (57 loc) · 1.78 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
import 'package:flutter/material.dart';
import 'package:flutter_radio_slider/flutter_radio_slider.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final themeData = SliderTheme.of(context).copyWith(
trackHeight: 10,
overlayColor: Colors.lightGreen.withAlpha(32),
activeTickMarkColor: Colors.lightGreen,
activeTrackColor: Colors.grey[300],
inactiveTrackColor: Colors.grey[300],
inactiveTickMarkColor: Colors.grey[500]);
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RadioSlider Example'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Horizontal with Divisions - Inner circle only"),
SliderTheme(
data: themeData,
child: RadioSlider(
onChanged: (value) {
// Do something
},
value: 3,
divisions: 5,
outerCircle: false,
),
),
Divider(),
Text("Default"),
RadioSlider(
activeColor: Colors.blue,
onChanged: (value) {/* no-op */},
),
Divider(),
Text("Vertical Orientation"),
SliderTheme(
data: themeData,
child: RadioSlider(
orientation: RadioSliderOrientation.Vertical,
onChanged: (value) {
print("Value changed: ${value.toString()}");
},
),
),
],
),
),
);
}
}