KeepPopupOpenStrategy
A contract for a strategy that determines whether a popup should stay open or not.
The strategy will be informed about some popup element, which it can query / listen to its events to determine if it should be kept open or not.
If users want to provide their own strategy, they should instantiate a class that implements this class and remember
it somewhere:
val manualStrategy = remember { KeepPopupOpenStrategy.manual() }
Popover(..., keepOpenStrategy = manualStrategy) {
Button(onClick = { manualStrategy.shouldKeepOpen = false }) { Text("Close") }
}
Content copied to clipboard
Children classes should implement this and fire emitShouldKeepOpen when they detect some change that determines if the popup should stay open or not.
Parameters
defaultValue
The initial "keep open" value for this strategy. Defaults to false
. Note that the same strategy can be reused for multiple lifecycles of a popup opening and closing, so each time it is reset, it will set its state back to this default value.