Hi team, I would like to suggest `IconButton` in `...
# compose-wear
y
Hi team, I would like to suggest
IconButton
in
androidx.wear.compose.material
, just noticed that I shall not use
androidx.compose.material
with compose wear. As I wrapped Icon in a Button, it attaches a shadow. How can I get ride of this shadow from the
Button
?
y
Button in wear material is designed for icons. Chip is generally the button for text. What is missing compared to IconButton?
y
The main idea is to give user some space to fling on the screen, only wenn user click on the transparent Icon, an alert will open.
The
androidx.compose.material.IconButton
doesn’t create a shadow. I can use a chip, to achieve the same result, but as i touch the text of the chip, the click event will also be triggered. I thought, if the text is not clickable, then user can have some screen space to fling the screen.
Maybe some background info to this. I have a pixel watch protection ring, which is over the bezel and make the bezel input impossible. The how screen is a SLC of chip items, with this half clickable head element. If i want to fling the SLC, it is almost impossible to touch other element.
j
as already mentioned the wear Button is an icon button - you mention a half clickable chip - I am not sure exactly what you mean by that - If you want a chip shape with two equal size same colored buttons in it then I don't see how the user would know that it has two clickable areas
We have a SplitToggleChip which has a ToggleControl and a clickable text area - but it has a visual effect to enable the user to know that there are two clickable areas
y
@John Nichol @yschimke Thanks for your feedback to my suggestion regarding
IconButton
, the main issue for me was the implementation of
androidx.wear.compose.material.Button
takes the Background color for Box in
Button
Composable from the
ButtonDefaults.primaryButtonColors()
With the following code, i can make the background of
Button
transparent now, which gives the same result as using
androidx.compose.material.IconButton
, so i think it is all good now.
Copy code
Button(
        modifier = Modifier,
        onClick = onClick,
        colors = ButtonDefaults.buttonColors(
            backgroundColor = Color.Transparent,
            contentColor = MaterialTheme.colors.primary
        ),
    ) { Icon( ... ) }
j
I think you just want
ButtonDefaults.iconButtonColors()
Ok if you plan on adding your own visual effect then I can see that might work - although I would consider the
SplitToggleChip
. You can use the base
Chip
which just provides you with with shape
y
Can you make the
SplitToggleChip
more generic, like a
SplitChip
with adding toggle or click event on each half? Thanks for mention
SplitToggleChip
, I will try it out to see how i can modify it for my need.
j
not really - it is a specific UI pattern that our UX team specified - it is not designed to be flexible/customized - it is there for situations where you want to give a dual affordance to a user
y
I see, thanks.