@@ -27,57 +27,56 @@ class NumericSettingWidget extends StatefulWidget {
2727class _NumericSettingWidgetState extends State <NumericSettingWidget > {
2828 @override
2929 Widget build (BuildContext context) {
30- return Row (
31- mainAxisAlignment: MainAxisAlignment .start,
32- crossAxisAlignment: CrossAxisAlignment .center,
33- children: [
34- SizedBox (
35- width: 280 ,
36- child: Padding (
37- padding: const EdgeInsets .fromLTRB (10 , 5 , 10 , 10 ),
38- child: Text (
39- '${widget .setting .label } - ' ,
40- textAlign: TextAlign .center,
41- style: const TextStyle (fontSize: 25 , color: Colors .white),
30+ return Padding (
31+ padding: const EdgeInsets .fromLTRB (0 , 5 , 0 , 0 ),
32+ child: Row (
33+ mainAxisAlignment: MainAxisAlignment .start,
34+ crossAxisAlignment: CrossAxisAlignment .center,
35+ children: [
36+ SizedBox (
37+ width: 280 ,
38+ child: Padding (
39+ padding: const EdgeInsets .fromLTRB (0 , 5 , 0 , 10 ),
40+ child: Text (
41+ '${widget .setting .label } - ' ,
42+ textAlign: TextAlign .center,
43+ style: const TextStyle (fontSize: 25 , color: Colors .white),
44+ ),
4245 ),
4346 ),
44- ),
45- SizedBox (
46- width: 200 ,
47- // height: 60,
48- child: CupertinoSpinBox (
49- // showButtons: false,
50- decoration: BoxDecoration (
51- color: Colors .white12, borderRadius: BorderRadius .circular (5 )),
52- textStyle: const TextStyle (fontSize: 25 , color: Colors .white),
53- spacing: 3 ,
54- min: widget.minAllowed,
55- max: widget.maxAllowed,
56- step: widget.step,
57- decimals: determineDecimals (widget.step),
58-
59- value: double .tryParse (widget.setting.value) ?? widget.minAllowed,
60-
61- onChanged: (double value) {
62- if (value < widget.minAllowed) {
63- value = widget.minAllowed;
64- }
65- if (value > widget.maxAllowed) {
66- value = widget.maxAllowed;
67- }
68- setState (() {
69- if (widget.step % 1 == 0 ) {
70- widget.setting.value = value.toStringAsFixed (0 );
71- } else {
72- widget.setting.value = value.toStringAsFixed (2 );
47+ SizedBox (
48+ width: 200 ,
49+ child: CupertinoSpinBox (
50+ decoration: BoxDecoration (
51+ color: Colors .white12,
52+ borderRadius: BorderRadius .circular (5 )),
53+ textStyle: const TextStyle (fontSize: 25 , color: Colors .white),
54+ spacing: 3 ,
55+ min: widget.minAllowed,
56+ max: widget.maxAllowed,
57+ step: widget.step,
58+ decimals: determineDecimals (widget.step),
59+ value: double .tryParse (widget.setting.value) ?? widget.minAllowed,
60+ onChanged: (double value) {
61+ if (value < widget.minAllowed) {
62+ value = widget.minAllowed;
7363 }
74-
75- widget.notifyParent ();
76- });
77- },
64+ if (value > widget.maxAllowed) {
65+ value = widget.maxAllowed;
66+ }
67+ setState (() {
68+ if (widget.step % 1 == 0 ) {
69+ widget.setting.value = value.toStringAsFixed (0 );
70+ } else {
71+ widget.setting.value = value.toStringAsFixed (2 );
72+ }
73+ widget.notifyParent ();
74+ });
75+ },
76+ ),
7877 ),
79- ) ,
80- ] ,
78+ ] ,
79+ ) ,
8180 );
8281 }
8382}
0 commit comments