-
-
Notifications
You must be signed in to change notification settings - Fork 544
Closed
Description
It would be useful to have an in-built LibrariesContainer that uses the Compose Wear M3 components, for displaying third-party libraries in Wear OS apps. Ideally this would be in its own module to avoid depending on the regular Compose M3 library.
Currently I am using the following example component using the compose-core-android module but it would be nice to have something more robust:
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.material3.ScreenScaffold
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TitleCard
import androidx.wear.compose.material3.ListHeader
import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries
import com.mikepenz.aboutlibraries.ui.compose.util.author
@Composable
fun ExampleWearLicenseScreen() {
val listState = rememberScalingLazyListState()
ScreenScaffold(
scrollState = listState
) { padding ->
val libs by produceLibraries()
val uriHandler = LocalUriHandler.current
ScalingLazyColumn(
state = listState,
contentPadding = padding
) {
item { ListHeader {
Text("Third-Party Licenses")
}}
items(libs?.libraries ?: emptyList(), key = { it.uniqueId }) {
TitleCard(
title = {
Text("${it.name} ${it.artifactVersion ?: ""}")
},
time = {
Text(it.author)
},
subtitle = {
Text(it.licenses.joinToString(", ") { l -> l.name })
},
onClick = {
// Open license on browser or connected phone.
it.licenses.first().apply {
if (!url.isNullOrBlank()) uriHandler.openUri(url!!)
}
}
)
}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels