@@ -39,8 +39,8 @@ class __PageState extends State<_Page> {
39
39
double height = 150.0 ;
40
40
double width = 150.0 ;
41
41
42
- Color borderColor;
43
- double borderWidth;
42
+ Color ? borderColor;
43
+ double ? borderWidth;
44
44
45
45
static final minWidth = 50.0 ;
46
46
static final maxWidth = 200.0 ;
@@ -67,10 +67,12 @@ class __PageState extends State<_Page> {
67
67
Padding (
68
68
padding:
69
69
const EdgeInsets .only (left: 8.0 , right: 8.0 , top: 8.0 ),
70
- child: RaisedButton (
71
- shape: RoundedRectangleBorder (
72
- borderRadius: BorderRadius .circular (12 )),
73
- color: Theme .of (context).colorScheme.secondary,
70
+ child: ElevatedButton (
71
+ style: ElevatedButton .styleFrom (
72
+ shape: RoundedRectangleBorder (
73
+ borderRadius: BorderRadius .circular (12 )),
74
+ backgroundColor: Theme .of (context).colorScheme.secondary,
75
+ ),
74
76
child: Text (
75
77
"back" ,
76
78
style: TextStyle (color: Colors .white),
@@ -123,12 +125,14 @@ class __PageState extends State<_Page> {
123
125
flex: 1 ,
124
126
child: Padding (
125
127
padding: const EdgeInsets .all (8.0 ),
126
- child: RaisedButton (
127
- shape: RoundedRectangleBorder (
128
- borderRadius: BorderRadius .circular (12 )),
129
- color: selectedConfiguratorIndex == 0
130
- ? buttonActiveColor
131
- : buttonInnactiveColor,
128
+ child: ElevatedButton (
129
+ style: ElevatedButton .styleFrom (
130
+ shape: RoundedRectangleBorder (
131
+ borderRadius: BorderRadius .circular (12 )),
132
+ backgroundColor: selectedConfiguratorIndex == 0
133
+ ? buttonActiveColor
134
+ : buttonInnactiveColor,
135
+ ),
132
136
child: Text (
133
137
"Style" ,
134
138
style: TextStyle (
@@ -149,9 +153,14 @@ class __PageState extends State<_Page> {
149
153
flex: 1 ,
150
154
child: Padding (
151
155
padding: const EdgeInsets .all (8.0 ),
152
- child: RaisedButton (
153
- shape: RoundedRectangleBorder (
154
- borderRadius: BorderRadius .circular (12 )),
156
+ child: ElevatedButton (
157
+ style: ElevatedButton .styleFrom (
158
+ shape: RoundedRectangleBorder (
159
+ borderRadius: BorderRadius .circular (12 )),
160
+ backgroundColor: selectedConfiguratorIndex == 1
161
+ ? buttonActiveColor
162
+ : buttonInnactiveColor,
163
+ ),
155
164
child: Text (
156
165
"Element" ,
157
166
style: TextStyle (
@@ -160,9 +169,6 @@ class __PageState extends State<_Page> {
160
169
: textInactiveColor,
161
170
),
162
171
),
163
- color: selectedConfiguratorIndex == 1
164
- ? buttonActiveColor
165
- : buttonInnactiveColor,
166
172
onPressed: () {
167
173
setState (() {
168
174
selectedConfiguratorIndex = 1 ;
@@ -175,9 +181,14 @@ class __PageState extends State<_Page> {
175
181
flex: 1 ,
176
182
child: Padding (
177
183
padding: const EdgeInsets .all (8.0 ),
178
- child: RaisedButton (
179
- shape: RoundedRectangleBorder (
180
- borderRadius: BorderRadius .circular (12 )),
184
+ child: ElevatedButton (
185
+ style: ElevatedButton .styleFrom (
186
+ shape: RoundedRectangleBorder (
187
+ borderRadius: BorderRadius .circular (12 )),
188
+ backgroundColor: selectedConfiguratorIndex == 2
189
+ ? buttonActiveColor
190
+ : buttonInnactiveColor,
191
+ ),
181
192
child: Text (
182
193
"Border" ,
183
194
style: TextStyle (
@@ -186,9 +197,6 @@ class __PageState extends State<_Page> {
186
197
: textInactiveColor,
187
198
),
188
199
),
189
- color: selectedConfiguratorIndex == 2
190
- ? buttonActiveColor
191
- : buttonInnactiveColor,
192
200
onPressed: () {
193
201
setState (() {
194
202
selectedConfiguratorIndex = 2 ;
@@ -209,15 +217,14 @@ class __PageState extends State<_Page> {
209
217
switch (selectedConfiguratorIndex) {
210
218
case 0 :
211
219
return styleCustomizer ();
212
- break ;
220
+
213
221
case 1 :
214
222
return elementCustomizer ();
215
- break ;
223
+
216
224
case 2 :
217
225
return borderCustomizer ();
218
- break ;
219
226
}
220
- return null ;
227
+ return const SizedBox . shrink () ;
221
228
}
222
229
223
230
Widget styleCustomizer () {
@@ -267,7 +274,7 @@ class __PageState extends State<_Page> {
267
274
onColorChanged: (color) {
268
275
setState (() {
269
276
NeumorphicTheme .of (context)
270
- .updateCurrentTheme (NeumorphicThemeData (baseColor: color));
277
+ ? .updateCurrentTheme (NeumorphicThemeData (baseColor: color));
271
278
});
272
279
},
273
280
color: NeumorphicTheme .baseColor (context),
@@ -292,7 +299,7 @@ class __PageState extends State<_Page> {
292
299
borderColor = color;
293
300
});
294
301
},
295
- color: borderColor,
302
+ color: borderColor ?? Colors .transparent ,
296
303
),
297
304
],
298
305
);
@@ -370,7 +377,7 @@ class __PageState extends State<_Page> {
370
377
child: Slider (
371
378
min: 0 ,
372
379
max: 10 ,
373
- value: borderWidth,
380
+ value: borderWidth ?? 0 ,
374
381
onChanged: (value) {
375
382
setState (() {
376
383
borderWidth = value;
@@ -380,7 +387,7 @@ class __PageState extends State<_Page> {
380
387
),
381
388
Padding (
382
389
padding: EdgeInsets .only (right: 12 ),
383
- child: Text (borderWidth.floor ().toString ()),
390
+ child: Text (( borderWidth ?? 0 ) .floor ().toString ()),
384
391
),
385
392
],
386
393
);
@@ -516,25 +523,28 @@ class __PageState extends State<_Page> {
516
523
final Color buttonInnactiveColor = Colors .white;
517
524
518
525
final Color iconActiveColor = Colors .white;
519
- final Color iconInactiveColor = Colors .black.withOpacity ( 0.3 );
526
+ final Color iconInactiveColor = Colors .black.withValues (alpha : 0.3 );
520
527
521
528
return Row (
522
529
mainAxisSize: MainAxisSize .max,
523
530
children: < Widget > [
524
531
Expanded (
525
532
child: Padding (
526
533
padding: const EdgeInsets .all (8.0 ),
527
- child: RaisedButton (
528
- shape: RoundedRectangleBorder (
529
- borderRadius: BorderRadius .circular (12 )),
534
+ child: ElevatedButton (
535
+ style: ElevatedButton .styleFrom (
536
+ shape: RoundedRectangleBorder (
537
+ borderRadius: BorderRadius .circular (12 ),
538
+ ),
539
+ backgroundColor: shape == NeumorphicShape .concave
540
+ ? buttonActiveColor
541
+ : buttonInnactiveColor,
542
+ ),
530
543
onPressed: () {
531
544
setState (() {
532
545
shape = NeumorphicShape .concave;
533
546
});
534
547
},
535
- color: shape == NeumorphicShape .concave
536
- ? buttonActiveColor
537
- : buttonInnactiveColor,
538
548
child: Image .asset ("assets/images/concave.png" ,
539
549
color: shape == NeumorphicShape .concave
540
550
? iconActiveColor
@@ -545,17 +555,20 @@ class __PageState extends State<_Page> {
545
555
Expanded (
546
556
child: Padding (
547
557
padding: const EdgeInsets .all (8.0 ),
548
- child: RaisedButton (
549
- shape: RoundedRectangleBorder (
550
- borderRadius: BorderRadius .circular (12 )),
558
+ child: ElevatedButton (
559
+ style: ElevatedButton .styleFrom (
560
+ shape: RoundedRectangleBorder (
561
+ borderRadius: BorderRadius .circular (12 ),
562
+ ),
563
+ backgroundColor: shape == NeumorphicShape .convex
564
+ ? buttonActiveColor
565
+ : buttonInnactiveColor,
566
+ ),
551
567
onPressed: () {
552
568
setState (() {
553
569
shape = NeumorphicShape .convex;
554
570
});
555
571
},
556
- color: shape == NeumorphicShape .convex
557
- ? buttonActiveColor
558
- : buttonInnactiveColor,
559
572
child: Image .asset ("assets/images/convex.png" ,
560
573
color: shape == NeumorphicShape .convex
561
574
? iconActiveColor
@@ -566,17 +579,20 @@ class __PageState extends State<_Page> {
566
579
Expanded (
567
580
child: Padding (
568
581
padding: const EdgeInsets .all (8.0 ),
569
- child: RaisedButton (
570
- shape: RoundedRectangleBorder (
571
- borderRadius: BorderRadius .circular (12 )),
582
+ child: ElevatedButton (
583
+ style: ElevatedButton .styleFrom (
584
+ shape: RoundedRectangleBorder (
585
+ borderRadius: BorderRadius .circular (12 ),
586
+ ),
587
+ backgroundColor: shape == NeumorphicShape .flat
588
+ ? buttonActiveColor
589
+ : buttonInnactiveColor,
590
+ ),
572
591
onPressed: () {
573
592
setState (() {
574
593
shape = NeumorphicShape .flat;
575
594
});
576
595
},
577
- color: shape == NeumorphicShape .flat
578
- ? buttonActiveColor
579
- : buttonInnactiveColor,
580
596
child: Image .asset ("assets/images/flat.png" ,
581
597
color: shape == NeumorphicShape .flat
582
598
? iconActiveColor
0 commit comments