[FEAT] Dismiss handler for toggle

This commit is contained in:
2026-01-25 14:12:01 +02:00
parent 0f19d432c7
commit b325776eed

View File

@@ -86,7 +86,7 @@ class AstromicSwitcherToggleState extends State<AstromicSwitcherToggle> {
} }
//SECTION - Action Callbacks //SECTION - Action Callbacks
_onTap(bool newValue) async { Future<void> _onTap(bool newValue) async {
if (widget.onStateChanged != null) { if (widget.onStateChanged != null) {
_currentState = await widget.onStateChanged!(_currentState); _currentState = await widget.onStateChanged!(_currentState);
} else { } else {
@@ -137,7 +137,7 @@ class AstromicSwitcherToggleState extends State<AstromicSwitcherToggle> {
inactiveIcon: _style.innerInactiveWidget, inactiveIcon: _style.innerInactiveWidget,
// //
padding: _style.togglePadding, padding: _style.togglePadding,
onToggle: !_config.isEnabled ? (bool v) {} : (bool s) => _onTap(s), onToggle: !_config.isEnabled ? (bool v) {} : (bool s) async => await _onTap(s),
), ),
//S1 -- Label Spacing //S1 -- Label Spacing
if (_config.withLabel) SizedBox(width: _style.labelSpacing), if (_config.withLabel) SizedBox(width: _style.labelSpacing),