Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix detekt warnings 2810 #2813

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.ivy.design.l0_system.UI
import com.ivy.resources.R
import com.ivy.legacy.IvyWalletComponentPreview
import com.ivy.resources.R
import com.ivy.wallet.ui.theme.Gradient

@Deprecated("Old design system. Use `:ivy-design` and Material3")
@Composable
fun CloseButton(
modifier: Modifier = Modifier,
onClick: () -> Unit
onClick: () -> Unit,
) {
CircleButton(
modifier = modifier,
icon = R.drawable.ic_dismiss,
contentDescription = "close",
onClick = onClick
onClick = onClick,
)
}

Expand All @@ -43,18 +43,18 @@ fun CircleButton(
backgroundColor: Color = UI.colors.pure,
borderColor: Color = UI.colors.medium,
tint: Color? = UI.colors.pureInverse,
onClick: () -> Unit
onClick: () -> Unit,
) {
Icon(
modifier = modifier
.clip(CircleShape)
.clickable(onClick = onClick)
.background(backgroundColor, CircleShape)
.border(2.dp, borderColor, CircleShape)
.padding(6.dp), // enlarge click area
.clickable(onClick = onClick) // enlarge click area
.padding(6.dp),
painter = painterResource(id = icon),
contentDescription = contentDescription,
tint = tint ?: Color.Unspecified
tint = tint ?: Color.Unspecified,
)
}

Expand All @@ -67,17 +67,17 @@ fun CircleButtonFilled(
backgroundColor: Color = UI.colors.medium,
tint: Color? = UI.colors.pureInverse,
clickAreaPadding: Dp = 8.dp,
onClick: () -> Unit
onClick: () -> Unit,
) {
Icon(
modifier = modifier
.clip(CircleShape)
.clickable(onClick = onClick)
.background(backgroundColor, CircleShape)
.padding(clickAreaPadding), // enlarge click area
.clickable(onClick = onClick) // enlarge click area
.padding(clickAreaPadding),
painter = painterResource(id = icon),
contentDescription = contentDescription,
tint = tint ?: Color.Unspecified
tint = tint ?: Color.Unspecified,
)
}

Expand All @@ -90,32 +90,31 @@ fun CircleButtonFilledGradient(
iconPadding: Dp = 8.dp,
backgroundGradient: Gradient = Gradient.solid(UI.colors.medium),
tint: Color? = UI.colors.pureInverse,
onClick: () -> Unit
onClick: () -> Unit,
) {
Icon(
modifier = modifier
.clip(CircleShape)
.clickable(onClick = onClick)
.background(backgroundGradient.asHorizontalBrush(), CircleShape)
.padding(iconPadding), // enlarge click area

.clickable(onClick = onClick) // enlarge click area
.padding(iconPadding),
painter = painterResource(id = icon),
contentDescription = contentDescription,
tint = tint ?: Color.Unspecified
tint = tint ?: Color.Unspecified,
)
}

@Deprecated("Old design system. Use `:ivy-design` and Material3")
@Composable
fun BackButton(
modifier: Modifier = Modifier,
onClick: () -> Unit
onClick: () -> Unit,
) {
CircleButton(
modifier = modifier,
icon = R.drawable.ic_back,
contentDescription = "back",
onClick = onClick
onClick = onClick,
)
}

Expand All @@ -136,3 +135,27 @@ private fun PreviewBackButton() {
}
}
}

@Preview
@Composable
private fun PreviewCircleButtonFilled() {
IvyWalletComponentPreview {
CircleButtonFilled(
icon = R.drawable.ic_sort_by_alpha_24,
onClick = {},
clickAreaPadding = 12.dp,
)
}
}

@Preview
@Composable
private fun PreviewCircleButtonFilledGradient() {
IvyWalletComponentPreview {
CircleButtonFilledGradient(
icon = R.drawable.ic_sort_by_alpha_24,
onClick = {},
iconPadding = 12.dp,
)
}
}