Skip to main content

didShowPanel

Notifies the SDK that the MaestroPanel was displayed.

Overview

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

Syntax

fun didShowPanel(panelType: MaestroPanelType?)

Parameters

ParameterTypeDescription
panelTypeMaestroPanelType?The type of panel that was shown, or null to select the first available panel

Example

@Composable
fun MaestroScreen(sdk: MaestroSDK.Instance, isPanelVisible: Boolean) {
Box(modifier = Modifier.fillMaxSize()) {
VideoPlayer()

if (isPanelVisible) {
MaestroPanel(
sdk = sdk,
modifier = Modifier.fillMaxSize(),
)

// Notify SDK that panel is visible
LaunchedEffect(Unit) {
sdk.didShowPanel(MaestroPanelType.Stats)
}
}
}
}

// When showing panel programmatically
fun showPanel(panelType: MaestroPanelType) {
// Update UI state
_isPanelVisible.value = true

// Notify SDK
sdk.didShowPanel(panelType)
}

// In response to shouldShowPanel delegate method
override fun shouldShowPanel() {
_isPanelVisible.value = true
lifecycleScope.launch {
sdk.didShowPanel(null)
}
}

Notes

  • Call this method after the panel becomes visible
  • The panel type should match the currently displayed panel
  • This helps the SDK track panel state and usage
  • Use LaunchedEffect in Compose to call this when panel appears