@@ -27,7 +27,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
2727import androidx.compose.ui.res.stringResource
2828import androidx.compose.ui.res.vectorResource
2929import androidx.compose.ui.unit.dp
30- import androidx.xr.compose.platform.SpatialCapabilities
3130import androidx.xr.scenecore.scene
3231
3332/* * Check if the device is XR-enabled, but is not yet rendering spatial UI. */
@@ -38,9 +37,8 @@ fun couldRequestFullSpace(): Boolean {
3837
3938/* * Check if the device is XR-enabled and is rendering spatial UI. */
4039@Composable
41- fun SpatialCapabilities.couldRequestHomeSpace (): Boolean {
42- if (! LocalSpatialConfiguration .current.hasXrSpatialFeature) return false
43- return isSpatialUiEnabled
40+ fun couldRequestHomeSpace (): Boolean {
41+ return LocalSpatialConfiguration .current.hasXrSpatialFeature && LocalSpatialCapabilities .current.isSpatialUiEnabled
4442}
4543
4644/* * Default styling for an IconButton with a home space button and behavior. */
@@ -68,19 +66,26 @@ fun RequestHomeSpaceIconButton(
6866 }
6967}
7068
71- /* * Default styling for an TopAppBar Button with a full space button and behavior. */
69+ /* * Default styling for an IconButton with a full space button and behavior. */
7270@Composable
73- fun RequestFullSpaceIconButton (modifier : Modifier = Modifier ) {
71+ fun RequestFullSpaceIconButton (
72+ modifier : Modifier = Modifier ,
73+ colors : IconButtonColors = IconButtonDefaults .iconButtonColors(),
74+ ) {
7475 val session = LocalSession .current ? : return
7576
7677 IconButton (
7778 modifier = modifier,
79+ colors = colors,
7880 onClick = {
7981 session.scene.requestFullSpaceMode()
8082 },
8183 ) {
8284 Icon (
83- ImageVector .vectorResource(R .drawable.expand_content_24px),
85+ modifier = Modifier
86+ .fillMaxSize()
87+ .padding(8 .dp),
88+ imageVector = ImageVector .vectorResource(R .drawable.expand_content_24px),
8489 contentDescription = stringResource(R .string.xr_to_full_space_mode),
8590 )
8691 }
0 commit comments