Remove Button elevation

This commit is contained in:
Andrew 2024-06-18 17:45:04 +09:30
parent 7826484320
commit 6ea535c9c7
2 changed files with 2 additions and 9 deletions

View File

@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.ButtonColors import androidx.compose.material.ButtonColors
import androidx.compose.material.ButtonDefaults import androidx.compose.material.ButtonDefaults
import androidx.compose.material.ButtonElevation
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.TextButton import androidx.compose.material.TextButton
@ -62,7 +61,6 @@ fun Button(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
size: ButtonStyle = ButtonStyle.Large, size: ButtonStyle = ButtonStyle.Large,
elevation: ButtonElevation? = type.elevation,
shape: Shape = MaterialTheme.shapes.small, shape: Shape = MaterialTheme.shapes.small,
border: BorderStroke? = type.border(color, enabled), border: BorderStroke? = type.border(color, enabled),
colors: ButtonColors = type.buttonColors(color), colors: ButtonColors = type.buttonColors(color),
@ -75,7 +73,7 @@ fun Button(
modifier.heightIn(min = size.minHeight), modifier.heightIn(min = size.minHeight),
enabled, enabled,
interactionSource, interactionSource,
elevation, elevation = null,
shape, shape,
border, border,
colors colors
@ -100,13 +98,12 @@ fun Button(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
size: ButtonStyle = ButtonStyle.Large, size: ButtonStyle = ButtonStyle.Large,
elevation: ButtonElevation? = type.elevation,
shape: Shape = MaterialTheme.shapes.small, shape: Shape = MaterialTheme.shapes.small,
border: BorderStroke? = type.border(color, enabled), border: BorderStroke? = type.border(color, enabled),
colors: ButtonColors = type.buttonColors(color), colors: ButtonColors = type.buttonColors(color),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) { ) {
Button(onClick, color, type, modifier, enabled, size, elevation, shape, border, colors, interactionSource) { Button(onClick, color, type, modifier, enabled, size, shape, border, colors, interactionSource) {
Text(text) Text(text)
} }
} }

View File

@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.ui.components
import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.BorderStroke
import androidx.compose.material.ButtonColors import androidx.compose.material.ButtonColors
import androidx.compose.material.ButtonDefaults import androidx.compose.material.ButtonDefaults
import androidx.compose.material.ButtonElevation
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -14,7 +13,6 @@ interface ButtonType {
fun border(color: Color, enabled: Boolean): BorderStroke? fun border(color: Color, enabled: Boolean): BorderStroke?
@Composable @Composable
fun buttonColors(color: Color): ButtonColors fun buttonColors(color: Color): ButtonColors
val elevation: ButtonElevation? @Composable get
object Outline: ButtonType { object Outline: ButtonType {
@Composable @Composable
@ -27,7 +25,6 @@ interface ButtonType {
disabledContentColor = LocalColors.current.disabled, disabledContentColor = LocalColors.current.disabled,
disabledBackgroundColor = Color.Unspecified disabledBackgroundColor = Color.Unspecified
) )
override val elevation: ButtonElevation? @Composable get() = null
} }
object Fill: ButtonType { object Fill: ButtonType {
@ -40,6 +37,5 @@ interface ButtonType {
disabledContentColor = LocalColors.current.disabled, disabledContentColor = LocalColors.current.disabled,
disabledBackgroundColor = Color.Unspecified disabledBackgroundColor = Color.Unspecified
) )
override val elevation: ButtonElevation @Composable get() = ButtonDefaults.elevation()
} }
} }