Skip to content

Commit

Permalink
Fix AppBar text button
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed May 31, 2024
1 parent 109d2e4 commit 2895166
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.horizontalsystems.bankwallet.ui.compose.components

import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -18,9 +17,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.toUpperCase
import androidx.compose.ui.unit.dp
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme
import io.horizontalsystems.bankwallet.ui.compose.TranslatableString
Expand Down Expand Up @@ -187,16 +184,14 @@ private fun MenuItemSimple(menuItem: MenuItem) {
showAlertDot = menuItem.showAlertDot,
)
} else {
Text(
modifier = Modifier
.padding(horizontal = 16.dp)
.clickable(
enabled = menuItem.enabled,
onClick = menuItem.onClick
),
text = menuItem.title.getString().toUpperCase(Locale.current),
style = ComposeAppTheme.typography.headline2,
color = color
)
ButtonPrimaryWrapper(
enabled = menuItem.enabled,
onClick = menuItem.onClick
){
Text(
text = menuItem.title.getString().uppercase(),
color = color
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
Expand All @@ -25,6 +26,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -279,6 +281,36 @@ fun ButtonPrimaryYellowWithSpinner(
)
}

@Composable
fun ButtonPrimaryWrapper(
modifier: Modifier = Modifier,
enabled: Boolean = true,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
ProvideTextStyle(
value = ComposeAppTheme.typography.headline2
) {
Box(
modifier = modifier
.clip(RoundedCornerShape(25.dp))
.defaultMinSize(
minWidth = ButtonPrimaryDefaults.MinWidth,
minHeight = ButtonPrimaryDefaults.MinHeight
)
.clickable(
enabled = enabled,
onClick = onClick,
)
.padding(ButtonPrimaryDefaults.ContentPadding),
contentAlignment = Alignment.Center,
) {
content()
}
}
}


@OptIn(ExperimentalMaterialApi::class)
@Composable
fun ButtonPrimary(
Expand Down

0 comments on commit 2895166

Please sign in to comment.