1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-21 15:44:26 +00:00

Make the room avatar shaped like a room

This commit is contained in:
Steffo 2024-01-24 05:07:38 +01:00
parent 111aa66d06
commit 7aff684a4c
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 37 additions and 3 deletions

View file

@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@ -16,6 +16,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.core.net.toFile
@ -117,8 +118,10 @@ fun RoomIconButton(
}
Box(modifier) {
// TODO: Figure out a way to clip this with a different shape
IconButton(
UnclippedIconButtonlike(
// FIXME: Seems like the end padding is off by a couple dp...
modifier = modifier
.clip(MaterialTheme.shapes.medium),
onClick = { expanded = true },
) {
AvatarURL(

View file

@ -0,0 +1,31 @@
package eu.steffo.twom.composables.viewroom
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
@Composable
fun UnclippedIconButtonlike(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
content: @Composable () -> Unit
) {
Box(
modifier = modifier
.size(40.dp)
.clickable(
onClick = onClick,
enabled = enabled,
role = Role.Button,
),
contentAlignment = Alignment.Center,
) {
content()
}
}