File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ class MyApp extends StatelessWidget {
2
+ const MyApp ({Key ? key}) : super (key: key);
3
+
4
+ static const String _title = 'Flutter Code Sample' ;
5
+
6
+ @override
7
+ Widget build (BuildContext context) {
8
+ return MaterialApp (
9
+ title: _title,
10
+ home: Scaffold (
11
+ appBar: AppBar (title: const Text (_title)),
12
+ body: const MyStatefulWidget (),
13
+ ),
14
+ );
15
+ }
16
+ }
17
+
18
+ /// This is the stateful widget that the main application instantiates.
19
+ class MyStatefulWidget extends StatefulWidget {
20
+ const MyStatefulWidget ({Key ? key}) : super (key: key);
21
+
22
+ @override
23
+ State <MyStatefulWidget > createState () => _MyStatefulWidgetState ();
24
+ }
25
+
26
+ /// This is the private State class that goes with MyStatefulWidget.
27
+ class _MyStatefulWidgetState extends State <MyStatefulWidget > {
28
+ double _currentSliderValue = 20 ;
29
+
30
+ @override
31
+ Widget build (BuildContext context) {
32
+ return Slider (
33
+ value: _currentSliderValue,
34
+ min: 0 ,
35
+ max: 100 ,
36
+ divisions: 5 ,
37
+ label: _currentSliderValue.round ().toString (),
38
+ onChanged: (double value) {
39
+ setState (() {
40
+ _currentSliderValue = value;
41
+ });
42
+ },
43
+ );
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments