inlay_compose 0.1.1
inlay_compose: ^0.1.1 copied to clipboard
Optional Jetpack Compose integration for the inlay framework - embed inlay Flutter screens directly into Compose navigation graphs. Android-only.
inlay_compose example #
Embedding inlay Flutter screens and dialogs in a Jetpack Compose host. For a
complete, runnable Compose host see
ComposeActivity.kt
in the example Android app.
Add the package next to inlay in your Flutter module's pubspec.yaml:
dependencies:
inlay: ^0.1.1
inlay_compose: ^0.1.1
Embed a Flutter screen as a Compose destination #
import co.leancode.inlay.compose.InlayFlutterScreen
NavHost(navController, startDestination = "home") {
composable("home") { HomeScreen() }
composable("counter") {
InlayFlutterScreen(
route = CounterPage(seed = null),
modifier = Modifier.fillMaxSize(),
onResult = { count ->
// count: Long? — the typed result the page popped with.
},
)
}
}
Show a Flutter dialog, state-driven #
import co.leancode.inlay.compose.InlayFlutterDialog
var showDialog by remember { mutableStateOf(false) }
Button(onClick = { showDialog = true }) { Text("Delete") }
InlayFlutterDialog(
isPresented = showDialog,
route = ConfirmDeleteDialog(itemId = "42"),
onDismissRequest = { showDialog = false },
onResult = { confirmed ->
// confirmed: Boolean? — already decoded.
},
)
See the navigation guide for the full Compose integration.