Fix meal planner editor

This commit is contained in:
2026-06-04 22:16:55 +02:00
parent d1916d3fe6
commit 4dd8ef5f8a
2 changed files with 129 additions and 100 deletions

View File

@@ -1,5 +1,6 @@
package dev.ulfrx.recipe.ui.screens.mealplaneditor
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -41,6 +42,7 @@ import dev.ulfrx.recipe.ui.theme.RecipeTheme
import kotlinx.datetime.LocalDate
import org.jetbrains.compose.resources.stringResource
import recipe.composeapp.generated.resources.Res
import recipe.composeapp.generated.resources.meal_plan_editor_title
import recipe.composeapp.generated.resources.meal_plan_editor_section_ingredients
import recipe.composeapp.generated.resources.meal_plan_editor_section_servings
import recipe.composeapp.generated.resources.meal_plan_editor_section_slot
@@ -94,6 +96,7 @@ internal fun MealPlanEditorContent(
editing.addedIngredients.mapTo(mutableSetOf()) { it.ingredientId }
}
Box(modifier = Modifier.fillMaxSize().background(RecipeTheme.colors.background)) {
Column(
modifier =
modifier
@@ -113,7 +116,7 @@ internal fun MealPlanEditorContent(
.padding(horizontal = spacing.lg + topChromeHeight + spacing.sm),
contentAlignment = Alignment.Center,
) {
RecipeTitle(title = editing.recipe.title)
RecipeTitle(recipeTitle = editing.recipe.title)
}
Spacer(Modifier.height(spacing.xl))
RecipeCalendarPill(
@@ -183,6 +186,7 @@ internal fun MealPlanEditorContent(
Spacer(Modifier.height(bottomInset + spacing.xxl))
}
}
}
@Composable
@@ -224,22 +228,48 @@ private fun SectionContainer(content: @Composable () -> Unit) {
@Composable
private fun RecipeTitle(
title: String,
recipeTitle: String,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
BasicText(
text = title,
text = stringResource(Res.string.meal_plan_editor_title),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style =
RecipeTheme.typography.body.copy(
color = RecipeTheme.colors.content,
fontWeight = FontWeight.SemiBold,
fontWeight = FontWeight.Medium,
fontSize = RecipeTitleSize,
lineHeight = RecipeTitleLineHeight,
textAlign = TextAlign.Center,
),
modifier = modifier,
modifier = Modifier.fillMaxWidth(),
)
Spacer(Modifier.height(RecipeTitleGap))
BasicText(
text = recipeTitle,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style =
RecipeTheme.typography.body.copy(
color = RecipeTheme.colors.contentMuted,
fontWeight = FontWeight.Normal,
fontSize = RecipeSubtitleSize,
lineHeight = RecipeSubtitleLineHeight,
textAlign = TextAlign.Center,
),
modifier = Modifier.fillMaxWidth(),
)
}
}
private val RecipeTitleSize = 14.sp
private val RecipeTitleSize = 16.sp
private val RecipeTitleLineHeight = 17.sp
private val RecipeTitleGap = 4.dp
private val RecipeSubtitleSize = 11.sp
private val RecipeSubtitleLineHeight = 14.sp

View File

@@ -35,14 +35,13 @@ fun recipeGlassFor(colors: RecipeColors): RecipeGlass =
frost = 0.dp,
),
button = RecipeGlassStyle(
refraction = 0.5f,
curve = 0.4f,
refraction = 0.3f,
curve = 0.2f,
edge = 0.03f,
dispersion = 0.5f,
saturation = 1f,
contrast = 1f,
frost = 15.dp,
tint = colors.surfaceGlass,
contrast = 0.85f,
frost = 5.dp,
),
panel = RecipeGlassStyle(
refraction = 0f,