Skip to content

Commit

Permalink
Use OutlinedButton for SignInWithGoogleButton
Browse files Browse the repository at this point in the history
This way the "Sign in with Google" button looks and behaves more like a regular button.
  • Loading branch information
cketti committed Aug 14, 2023
1 parent 5e9d9fe commit a9179b6
Showing 1 changed file with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ package app.k9mail.feature.account.oauth.ui.view
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.ButtonElevation
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedButton
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -43,21 +41,19 @@ fun SignInWithGoogleButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
isLight: Boolean = MaterialTheme.colors.isLight,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.elevation(),
) {
Surface(
modifier = Modifier
.border(
width = 1.dp,
color = getBorderColor(isLight),
shape = RoundedCornerShape(8.dp),
)
.clickable { onClick() }
.then(modifier),
shape = RoundedCornerShape(8.dp),
color = getSurfaceColor(isLight),
elevation = elevation?.elevation(true, interactionSource)?.value ?: 0.dp,
OutlinedButton(
onClick = onClick,
modifier = modifier,
colors = ButtonDefaults.outlinedButtonColors(
contentColor = getTextColor(isLight),
backgroundColor = getSurfaceColor(isLight),
),
border = BorderStroke(
width = 1.dp,
color = getBorderColor(isLight),
),
contentPadding = PaddingValues(all = 0.dp),
) {
Row(
modifier = Modifier
Expand Down

0 comments on commit a9179b6

Please sign in to comment.