@@ -154,9 +154,9 @@ class _MyHomePageState extends State<MyHomePage> {
154154 colors: [green, Colors .red[800 ]! ],
155155 stops: [
156156 global.position -
157- (1 - 2 * max (0 , global.position - 0.5 )) * 0.2 ,
157+ (1 - 2 * max (0 , global.position - 0.5 )) * 0.7 ,
158158 global.position +
159- max (0 , 2 * (global.position - 0.5 )) * 0.2 ,
159+ max (0 , 2 * (global.position - 0.5 )) * 0.7 ,
160160 ],
161161 ));
162162 },
@@ -269,7 +269,7 @@ class _MyHomePageState extends State<MyHomePage> {
269269 Padding (
270270 padding: const EdgeInsets .all (8.0 ),
271271 child: Text (
272- 'Switch inspired by package lite_rolling_switch' ,
272+ 'Switch similar to package lite_rolling_switch' ,
273273 textAlign: TextAlign .center,
274274 ),
275275 ),
@@ -300,10 +300,7 @@ class _MyHomePageState extends State<MyHomePage> {
300300 CupertinoActivityIndicator (
301301 color: Color .lerp (
302302 Colors .red[800 ], green, global.position)),
303- onChanged: (b) {
304- setState (() => positive = b);
305- return Future <dynamic >.delayed (Duration (seconds: 2 ));
306- },
303+ onChanged: (b) => setState (() => positive = b),
307304 iconBuilder: (value) => value
308305 ? Icon (Icons .power_outlined, color: green, size: 32.0 )
309306 : Icon (Icons .power_settings_new_rounded,
@@ -375,6 +372,7 @@ class _MyHomePageState extends State<MyHomePage> {
375372 active: false ,
376373 current: value,
377374 values: const [0 , 1 , 2 , 3 ],
375+ indicatorIconScale: sqrt2,
378376 onChanged: (i) {
379377 setState (() {
380378 value = i;
@@ -423,6 +421,7 @@ class _MyHomePageState extends State<MyHomePage> {
423421 )
424422 ],
425423 ),
424+ indicatorIconScale: sqrt2,
426425 iconBuilder: coloredRollingIconBuilder,
427426 borderWidth: 3.0 ,
428427 styleAnimationType: AnimationType .onHover,
@@ -457,7 +456,11 @@ class _MyHomePageState extends State<MyHomePage> {
457456 current: nullableValue,
458457 allowUnlistedValues: true ,
459458 values: const [0 , 1 , 2 , 3 ],
460- onTap: () => setState (() => nullableValue = null ),
459+ onTap: (info) {
460+ if (nullableValue == info.tapped? .value) {
461+ setState (() => nullableValue = null );
462+ }
463+ },
461464 onChanged: (i) => setState (() => nullableValue = i),
462465 iconBuilder: rollingIconBuilder,
463466 borderWidth: 4.5 ,
@@ -490,7 +493,7 @@ class _MyHomePageState extends State<MyHomePage> {
490493 return const SizedBox ();
491494 },
492495 cursors: ToggleCursors (defaultCursor: SystemMouseCursors .click),
493- onTap: () => setState (() => positive = ! positive),
496+ onTap: (_ ) => setState (() => positive = ! positive),
494497 iconsTappable: false ,
495498 wrapperBuilder: (context, global, child) {
496499 return Stack (
@@ -703,6 +706,7 @@ class _MyHomePageState extends State<MyHomePage> {
703706 current: value,
704707 values: const [0 , 1 , 2 , 3 ],
705708 iconOpacity: 1.0 ,
709+ selectedIconScale: 1.0 ,
706710 indicatorSize: const Size .fromWidth (25 ),
707711 foregroundIndicatorIconBuilder: (context, global) {
708712 double pos = global.position;
0 commit comments