diff --git a/core/src/main/kotlin/com/imashnake/animite/core/extensions/ModifierExt.kt b/core/src/main/kotlin/com/imashnake/animite/core/extensions/ModifierExt.kt index 92feb0de..85633850 100644 --- a/core/src/main/kotlin/com/imashnake/animite/core/extensions/ModifierExt.kt +++ b/core/src/main/kotlin/com/imashnake/animite/core/extensions/ModifierExt.kt @@ -3,10 +3,13 @@ package com.imashnake.animite.core.extensions import android.content.res.Configuration import androidx.compose.foundation.ScrollState import androidx.compose.foundation.layout.displayCutoutPadding +import androidx.compose.foundation.layout.heightIn import androidx.compose.ui.Modifier import androidx.compose.ui.composed import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp fun Modifier.landscapeCutoutPadding() = composed { if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE) { @@ -19,3 +22,5 @@ fun Modifier.landscapeCutoutPadding() = composed { fun Modifier.bannerParallax(scrollState: ScrollState) = graphicsLayer { translationY = 0.7f * scrollState.value } + +fun Modifier.maxHeight(max: Dp) = this.heightIn(0.dp, max) diff --git a/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt b/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt index 0de7b877..c00dfa56 100644 --- a/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt +++ b/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.MaterialTheme @@ -25,6 +24,7 @@ import com.boswelja.markdown.material3.m3CodeBlockStyle import com.boswelja.markdown.material3.m3TextStyleModifiers import com.boswelja.markdown.material3.m3TextStyles import com.imashnake.animite.core.extensions.animiteBlockQuoteStyle +import com.imashnake.animite.core.extensions.maxHeight import com.imashnake.animite.core.ui.LocalPaddings import com.imashnake.animite.core.ui.NestedScrollableContent import com.imashnake.animite.core.ui.layouts.BannerLayout @@ -32,7 +32,6 @@ import com.imashnake.animite.profile.dev.internal.ANILIST_AUTH_DEEPLINK import com.ramcosta.composedestinations.annotation.DeepLink import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootNavGraph -import com.imashnake.animite.core.R as coreR @Destination( route = "user", @@ -91,12 +90,7 @@ fun ProfileScreen( style = MaterialTheme.typography.titleLarge, overflow = TextOverflow.Ellipsis ) - Box( - Modifier.heightIn( - dimensionResource(coreR.dimen.zero), - dimensionResource(R.dimen.user_about_height) - ) - ) { + Box(Modifier.maxHeight(dimensionResource(R.dimen.user_about_height))) { NestedScrollableContent { contentModifier -> about?.let { MarkdownDocument(