From 797d41f25d1f566fc56ecad5704ae35e3c3396c0 Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Sun, 25 Jan 2026 14:14:25 +0200 Subject: [PATCH] [FEAT] Dismiss handler for toggle --- lib/src/Toggles/Switcher/switcher.toggle.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/Toggles/Switcher/switcher.toggle.dart b/lib/src/Toggles/Switcher/switcher.toggle.dart index be38fc3..5776711 100644 --- a/lib/src/Toggles/Switcher/switcher.toggle.dart +++ b/lib/src/Toggles/Switcher/switcher.toggle.dart @@ -87,14 +87,16 @@ class AstromicSwitcherToggleState extends State { //SECTION - Action Callbacks Future _onTap(bool newValue) async { - if (widget.onStateChanged != null) { - _currentState = await widget.onStateChanged!(_currentState); - } else { - _currentState = newValue; - } setState(() { - // + _currentState = newValue; }); + + if (widget.onStateChanged != null) { + bool shouldRevert = await widget.onStateChanged!(_currentState); + setState(() { + _currentState = shouldRevert; + }); + } } //!SECTION