Skip to content

fix(tipcard): tweaks mimiced inner shadow on tip card to not render weird on lower density #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions app/src/main/java/com/getcode/view/main/bill/TipCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.drawscope.inset
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.getcode.theme.Brand
import com.getcode.theme.CodeTheme
Expand Down Expand Up @@ -95,21 +98,21 @@ private fun HazedBackground(
)
// mimic an inner shadow from Figma
.drawBehind {
drawRect(
brush = Brush.radialGradient(
colors = listOf(
Color.White.copy(0.45f),
background.copy(alpha = 0.24f)
inset(
horizontal = 2.dp.toPx(),
vertical = 2.dp.toPx()
) {
drawRect(
brush = Brush.radialGradient(
colors = listOf(
Color.White.copy(0.45f),
background.copy(alpha = 0.24f)
),
center = Offset.Zero,
radius = size.maxDimension
),
center = Offset.Zero,
radius = size.maxDimension
),
size = size.copy(width = size.width * 0.9f, height = size.height * 0.93f),
topLeft = Offset(
geometry.size.width.value * 0.1f,
geometry.size.height.value * 0.07f
)
)
}
}
)
}
Expand Down
Loading