diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt index 9c1012b6e7..dd87930332 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex import com.google.accompanist.insets.navigationBarsPadding import com.google.accompanist.insets.statusBarsPadding +import com.ivy.design.l0_system.SunsetNight import com.ivy.design.l0_system.Theme import com.ivy.design.l0_system.UI import com.ivy.design.l0_system.style @@ -34,10 +35,13 @@ import com.ivy.frp.view.navigation.navigation import com.ivy.wallet.Constants import com.ivy.wallet.R import com.ivy.wallet.ui.* +import com.ivy.wallet.ui.donate.DonateScreen import com.ivy.wallet.ui.theme.Blue +import com.ivy.wallet.ui.theme.Gradient import com.ivy.wallet.ui.theme.Gray import com.ivy.wallet.ui.theme.components.BufferBattery import com.ivy.wallet.ui.theme.components.CircleButtonFilled +import com.ivy.wallet.ui.theme.components.IvyButton import com.ivy.wallet.ui.theme.components.IvyIcon import com.ivy.wallet.ui.theme.modal.AddModalBackHandling import com.ivy.wallet.ui.theme.wallet.AmountCurrencyB1 @@ -156,12 +160,17 @@ fun BoxWithConstraintsScope.MoreMenu( } } + if (percentExpanded > 0.01f) { + DonateButton( + percentExpanded = percentExpanded + ) + } + CircleButtonFilled( modifier = Modifier .layout { measurable, constraints -> val placeable = measurable.measure(constraints) - layout(placeable.width, placeable.height) { placeable.place( x = xBase.roundToInt() - buttonSizePx.roundToInt(), @@ -179,7 +188,6 @@ fun BoxWithConstraintsScope.MoreMenu( ) { setExpanded(!expanded) } - } @Composable @@ -553,6 +561,28 @@ private fun Preview_Expanded() { } } +@Composable +private fun BoxWithConstraintsScope.DonateButton( + percentExpanded: Float +) { + val nav = navigation() + IvyButton( + modifier = Modifier + .align(Alignment.BottomCenter) + .navigationBarsPadding() + .padding(bottom = 40.dp) + .zIndex(510f) + .alpha(percentExpanded), + text = "Donate", + iconStart = R.drawable.ic_donate_crown, + iconEdgePadding = 16.dp, + iconTextPadding = 12.dp, + backgroundGradient = Gradient.from(SunsetNight) + ) { + nav.navigateTo(DonateScreen) + } +} + @Preview @Composable private fun Preview() { diff --git a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt index 0d90d8680f..c3559c2c7c 100644 --- a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt @@ -357,7 +357,7 @@ private fun BoxWithConstraintsScope.UI( icon = R.drawable.ic_donate_crown, text = "Donate", iconPadding = 8.dp, - backgroundGradient = Gradient(SunsetNight.startColor, SunsetNight.endColor) + backgroundGradient = Gradient.from(SunsetNight) ) { nav.navigateTo(DonateScreen) } diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/IvyColors.kt b/app/src/main/java/com/ivy/wallet/ui/theme/IvyColors.kt index 7a5da8ff1e..e13f41772b 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/IvyColors.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/IvyColors.kt @@ -180,6 +180,9 @@ data class Gradient( val endColor: Color ) { companion object { + fun from(gradient: com.ivy.design.l0_system.Gradient) = + Gradient(gradient.startColor, gradient.endColor) + fun from(startColor: Int, endColor: Int?) = Gradient( startColor = startColor.toComposeColor(), endColor = (endColor ?: startColor).toComposeColor() diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt index 4b1edaa55f..79e4ed5921 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt @@ -47,6 +47,7 @@ fun IvyButton( hasGlow: Boolean = true, padding: Dp = 12.dp, iconEdgePadding: Dp = 12.dp, + iconTextPadding: Dp = 4.dp, onClick: () -> Unit ) { Row( @@ -77,6 +78,7 @@ fun IvyButton( icon = iconStart, tint = iconTint, iconEdgePadding = iconEdgePadding, + iconTextPadding = iconTextPadding ) } iconEnd != null && !wrapContentMode -> { @@ -84,6 +86,7 @@ fun IvyButton( icon = iconEnd, tint = Color.Transparent, iconEdgePadding = iconEdgePadding, + iconTextPadding = iconTextPadding ) } else -> { @@ -113,6 +116,7 @@ fun IvyButton( icon = iconStart, tint = Color.Transparent, iconEdgePadding = iconEdgePadding, + iconTextPadding = iconTextPadding ) } iconEnd != null -> { @@ -120,6 +124,7 @@ fun IvyButton( icon = iconEnd, tint = iconTint, iconEdgePadding = iconEdgePadding, + iconTextPadding = iconTextPadding ) } else -> { @@ -132,6 +137,7 @@ fun IvyButton( @Composable private fun IconStart( iconEdgePadding: Dp, + iconTextPadding: Dp, icon: Int, tint: Color, ) { @@ -144,16 +150,17 @@ private fun IconStart( tint = tint, ) - Spacer(modifier = Modifier.width(4.dp)) + Spacer(modifier = Modifier.width(iconTextPadding)) } @Composable private fun IconEnd( iconEdgePadding: Dp, + iconTextPadding: Dp, icon: Int, tint: Color, ) { - Spacer(modifier = Modifier.width(4.dp)) + Spacer(modifier = Modifier.width(iconTextPadding)) Icon( modifier = Modifier,