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:
parent
111aa66d06
commit
7aff684a4c
2 changed files with 37 additions and 3 deletions
|
@ -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(
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue