Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Jetsnack/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ android {
kotlin {
compilerOptions {
jvmTarget = JvmTarget.fromTarget("17")
freeCompilerArgs.add("-opt-in=androidx.compose.foundation.style.ExperimentalFoundationStyleApi")
}
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@
package com.example.jetsnack.ui.components

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.indication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.style.Style
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ProvideTextStyle
Expand All @@ -38,11 +35,7 @@ import androidx.compose.runtime.Composable
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.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import com.example.jetsnack.ui.theme.JetsnackTheme
Expand All @@ -53,27 +46,12 @@ fun JetsnackButton(
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
shape: Shape = ButtonShape,
border: BorderStroke? = null,
backgroundGradient: List<Color> = JetsnackTheme.colors.interactivePrimary,
disabledBackgroundGradient: List<Color> = JetsnackTheme.colors.interactiveSecondary,
contentColor: Color = JetsnackTheme.colors.textInteractive,
disabledContentColor: Color = JetsnackTheme.colors.textHelp,
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
style: Style = Style,
content: @Composable RowScope.() -> Unit,
) {
JetsnackSurface(
shape = shape,
color = Color.Transparent,
contentColor = if (enabled) contentColor else disabledContentColor,
border = border,
modifier = modifier
.clip(shape)
.background(
Brush.horizontalGradient(
colors = if (enabled) backgroundGradient else disabledBackgroundGradient,
),
)
.clickable(
onClick = onClick,
enabled = enabled,
Expand All @@ -91,8 +69,7 @@ fun JetsnackButton(
minWidth = ButtonDefaults.MinWidth,
minHeight = ButtonDefaults.MinHeight,
)
.indication(interactionSource, ripple())
.padding(contentPadding),
.indication(interactionSource, ripple()),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
content = content,
Expand Down Expand Up @@ -122,7 +99,7 @@ private fun ButtonPreview() {
private fun RectangleButtonPreview() {
JetsnackTheme {
JetsnackButton(
onClick = {}, shape = RectangleShape,
onClick = {},
) {
Text(text = "Demo")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ fun ProvideJetsnackColors(colors: JetsnackColors, content: @Composable () -> Uni

private val LocalJetsnackColors = staticCompositionLocalOf<JetsnackColors> {
error("No JetsnackColorPalette provided")
}

/**
* A Material [Colors] implementation which sets all colors to [debugColor] to discourage usage of
Expand Down
2 changes: 1 addition & 1 deletion Jetsnack/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android-material3 = "1.14.0-alpha09"
androidGradlePlugin = "9.0.1"
androidx-activity-compose = "1.13.0"
androidx-appcompat = "1.7.1"
androidx-compose-bom = "2026.03.00"
androidx-compose-bom = "2026.04.01"
androidx-core-splashscreen = "1.2.0"
androidx-corektx = "1.17.0"
androidx-glance = "1.2.0-rc01"
Expand Down
Loading