Skip to main content

didHidePanel

Notifies the SDK that MaestroPanel was hidden.

Overview

Call this method after your app hides the Maestro panel to inform the SDK that the panel is no longer visible. This allows the SDK to track panel visibility state and adjust its behavior accordingly.

Syntax

abstract fun didHidePanel()

Example

@Composable
fun MaestroScreen(sdk: MaestroSDK.Instance, isPanelVisible: Boolean) {
val viewModel = maestroEventViewModel(sdk)

Box(modifier = Modifier.fillMaxSize()) {
VideoPlayer()

if (isPanelVisible) {
MaestroPanel(
maestroEventViewModel = viewModel,
modifier = Modifier.fillMaxSize(),
)
} else {
// Notify SDK when panel is hidden
LaunchedEffect(Unit) {
viewModel.didHidePanel()
}
}
}
}

// When hiding panel programmatically
fun hidePanel() {
// Update UI state
_isPanelVisible.value = false

// Notify SDK
viewModel.didHidePanel()
}

// In response to shouldHidePanel delegate method
override fun shouldHidePanel() {
_isPanelVisible.value = false
lifecycleScope.launch {
viewModel.didHidePanel()
}
}

Notes

  • Call this method after the panel becomes hidden
  • This helps the SDK track panel state
  • Use LaunchedEffect in Compose to call this when panel disappears
  • The SDK may pause certain operations when the panel is hidden