shouldHidePanel
Notifies the client app that the panel should be dismissed.
Overview
The SDK calls this method when the panel should be hidden from the user. This can occur due to user interaction, SDK logic, or event triggers. Your app should respond by updating its UI to hide the panel.
Syntax
abstract fun shouldHidePanel()
Example
class MyActivity : ComponentActivity(), MaestroEventDelegate {
private val _isPanelVisible = MutableStateFlow(false)
override fun shouldShowPanel() {
_isPanelVisible.value = true
}
override fun shouldHidePanel() {
_isPanelVisible.value = false
}
}
@Composable
fun MaestroScreen(sdk: MaestroSDK.Instance, isPanelVisible: StateFlow<Boolean>) {
val showPanel by isPanelVisible.collectAsState()
val viewModel = maestroEventViewModel(sdk)
Box(modifier = Modifier.fillMaxSize()) {
VideoPlayer()
if (showPanel) {
MaestroPanel(
maestroEventViewModel = viewModel,
modifier = Modifier.fillMaxSize(),
)
} else {
// Notify SDK when panel is hidden
LaunchedEffect(Unit) {
viewModel.didHidePanel()
}
}
}
}
Notes
- Update your UI state to hide the panel
- Notify the SDK when the panel becomes hidden using
didHidePanel() - Handle cases where the panel is already hidden
- Consider animation or transition effects for better UX
Related Methods
- shouldShowPanel() - Shows the panel
- didHidePanel() - Notify SDK panel is hidden