TappableActionConfig.toggle constructor
const
TappableActionConfig.toggle({
- bool requireNetwork = true,
- bool debounceTaps = true,
- Duration? coolDownDuration = const Duration(milliseconds: 500),
- Duration? delayBeforeFirstTapDuration,
- bool disableVisuallyDuringFirstDelay = true,
- Duration? minDisabledDuration,
- String? groupId,
- bool disableVisuallyDuringDebouncing = true,
- TapExecutionMode executionMode = TapExecutionMode.throttle,
- bool executeOnLeadingEdge = true,
- bool executeOnTrailingEdge = false,
- TapConcurrencyMode concurrencyMode = TapConcurrencyMode.replace,
- int rateLimitMaxTokens = 10,
- Duration rateLimitRefillInterval = const Duration(seconds: 1),
- int rateLimitTokensPerRefill = 5,
- void onMetrics()?,
- bool enabled = true,
- Duration? maxDuration,
- String? debugName,
For like/favorite buttons - immediate feedback, replace on rapid tap.
Implementation
const TappableActionConfig.toggle({
this.requireNetwork = true,
this.debounceTaps = true,
this.coolDownDuration = const Duration(milliseconds: 500),
this.delayBeforeFirstTapDuration,
this.disableVisuallyDuringFirstDelay = true,
this.minDisabledDuration,
this.groupId,
this.disableVisuallyDuringDebouncing = true,
// Toggle-specific: throttle with replace mode
this.executionMode = TapExecutionMode.throttle,
this.executeOnLeadingEdge = true,
this.executeOnTrailingEdge = false,
this.concurrencyMode = TapConcurrencyMode.replace,
this.rateLimitMaxTokens = 10,
this.rateLimitRefillInterval = const Duration(seconds: 1),
this.rateLimitTokensPerRefill = 5,
this.onMetrics,
this.enabled = true,
this.maxDuration,
this.debugName,
});