[FEAT] Dismiss handler for toggle

This commit is contained in:
2026-01-25 14:14:25 +02:00
parent b325776eed
commit 797d41f25d

View File

@@ -87,14 +87,16 @@ class AstromicSwitcherToggleState extends State<AstromicSwitcherToggle> {
//SECTION - Action Callbacks
Future<void> _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