Fix button shape

This commit is contained in:
Andrew 2024-06-18 22:21:04 +09:30
parent a3ff911920
commit 68a3f9d6f7
3 changed files with 8 additions and 8 deletions

View File

@ -16,14 +16,12 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card import androidx.compose.material.Card
import androidx.compose.material.ContentAlpha import androidx.compose.material.ContentAlpha
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.IconButton import androidx.compose.material.IconButton
import androidx.compose.material.LocalContentAlpha import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
@ -47,7 +45,7 @@ import kotlin.math.sign
@Composable @Composable
fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) { fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) {
if (pagerState.pageCount >= 2) Card( if (pagerState.pageCount >= 2) Card(
shape = MaterialTheme.shapes.large, shape = pillShape,
backgroundColor = Color.Black.copy(alpha = 0.4f), backgroundColor = Color.Black.copy(alpha = 0.4f),
modifier = Modifier modifier = Modifier
.align(Alignment.BottomCenter) .align(Alignment.BottomCenter)

View File

@ -80,10 +80,12 @@ private fun Colors.toMaterialColors() = androidx.compose.material.Colors(
@Composable private fun Context.colors() = AppTextSecurePreferences(this).colors() @Composable private fun Context.colors() = AppTextSecurePreferences(this).colors()
val pillShape = RoundedCornerShape(percent = 50)
val buttonShape = pillShape
val sessionShapes = Shapes( val sessionShapes = Shapes(
small = RoundedCornerShape(12.dp), small = RoundedCornerShape(12.dp),
medium = RoundedCornerShape(16.dp), medium = RoundedCornerShape(16.dp)
large = RoundedCornerShape(50.dp)
) )
/** /**

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.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.TextButton import androidx.compose.material.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -43,6 +42,7 @@ import org.thoughtcrime.securesms.ui.LaunchedEffectAsync
import org.thoughtcrime.securesms.ui.PreviewTheme import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
import org.thoughtcrime.securesms.ui.baseBold import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.buttonShape
import org.thoughtcrime.securesms.ui.color.Colors import org.thoughtcrime.securesms.ui.color.Colors
import org.thoughtcrime.securesms.ui.color.LocalColors import org.thoughtcrime.securesms.ui.color.LocalColors
import org.thoughtcrime.securesms.ui.contentDescription import org.thoughtcrime.securesms.ui.contentDescription
@ -61,7 +61,7 @@ fun Button(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
style: ButtonStyle = ButtonStyle.Large, style: ButtonStyle = ButtonStyle.Large,
shape: Shape = MaterialTheme.shapes.large, shape: Shape = buttonShape,
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() },
@ -98,7 +98,7 @@ fun Button(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
size: ButtonStyle = ButtonStyle.Large, size: ButtonStyle = ButtonStyle.Large,
shape: Shape = MaterialTheme.shapes.large, shape: Shape = buttonShape,
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() },