Skip to content

Conversation

astamato
Copy link
Contributor

@astamato astamato commented Jun 27, 2022

Fixes #855

Before:

After:

@astamato astamato marked this pull request as ready for review June 27, 2022 19:04
@astamato astamato requested a review from a team as a code owner June 27, 2022 19:04
@astamato astamato requested review from kul3r4 and IanGClifton and removed request for kul3r4 June 27, 2022 19:04
Copy link
Contributor

@IanGClifton IanGClifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think when this was originally written, it was meant to have a background around the selected button only (more like how tabs work) but that was implemented by setting the enabled property, which is why clicking doesn't actually work. I don't think there's any selectable button that we can use, but we should be able to do something like changed ExtendedSelectorInnerButton to directly use a Surface:

    val colorSelected = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.08f)
    val colorUnselected = Color.Transparent
    val contentColorSelected = MaterialTheme.colorScheme.onSurface
    val contentColorUnselected = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.74f)

    Surface(
        onClick = onClick,
        modifier = modifier.padding(8.dp).height(36.dp),
        shape = RoundedCornerShape(percent = 50),
        color = if (selected) { colorSelected } else { colorUnselected },
        contentColor = if (selected) { contentColorSelected} else { contentColorUnselected},
        selected = selected,
    ) {
        Row(
            horizontalArrangement = Arrangement.Center,
            verticalAlignment = Alignment.CenterVertically,
        ) {
            Text(
                text = text,
                style = MaterialTheme.typography.titleSmall
            )
        }
    }

I might be missing some of the styling, but hopefully that's close enough to show what I mean :)

@astamato
Copy link
Contributor Author

@IanGClifton yep I took a shortcut, how about now? button will still have a feedback ripple but will look disabled

@astamato astamato force-pushed the as/jetchat-fix-855 branch from 44135c3 to e4d8347 Compare June 28, 2022 10:21
@astamato astamato requested a review from IanGClifton June 28, 2022 10:21
Copy link
Contributor

@IanGClifton IanGClifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yeah this is a good simple fix :)

@astamato astamato merged commit f735a5a into main Jun 29, 2022
@astamato astamato deleted the as/jetchat-fix-855 branch June 29, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JetChat] Unreachable code In EmojiSelector Composable In UserInput.kt
2 participants