Skip to content

Commit

Permalink
fix(ModalBottomSheet): adjust padding
Browse files Browse the repository at this point in the history
  • Loading branch information
aliernfrog committed Nov 27, 2022
1 parent fa5149e commit 2cb0507
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aliernfrog.pftool.PFToolComposableShape
import com.aliernfrog.pftool.PFToolRoundnessSize
import com.aliernfrog.pftool.util.GeneralUtil

@OptIn(ExperimentalMaterialApi::class)
@Composable
Expand All @@ -32,7 +31,7 @@ fun PFToolModalBottomSheet(title: String? = null, sheetState: ModalBottomSheetSt
sheetElevation = 0.dp,
content = {},
sheetContent = {
Column(modifier = Modifier.statusBarsPadding().fillMaxWidth().clip(RoundedCornerShape(topStart = PFToolRoundnessSize, topEnd = PFToolRoundnessSize)).background(MaterialTheme.colorScheme.background), horizontalAlignment = Alignment.CenterHorizontally) {
Column(modifier = Modifier.statusBarsPadding().fillMaxWidth().clip(RoundedCornerShape(topStart = PFToolRoundnessSize, topEnd = PFToolRoundnessSize)).background(MaterialTheme.colorScheme.background).navigationBarsPadding().imePadding(), horizontalAlignment = Alignment.CenterHorizontally) {
Box(modifier = Modifier
.padding(vertical = 8.dp)
.background(MaterialTheme.colorScheme.surfaceVariant, shape = PFToolComposableShape)
Expand All @@ -42,7 +41,6 @@ fun PFToolModalBottomSheet(title: String? = null, sheetState: ModalBottomSheetSt
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(topStart = PFToolRoundnessSize, topEnd = PFToolRoundnessSize)).verticalScroll(sheetScrollState)) {
if (title != null) Text(text = title, fontSize = 30.sp, modifier = Modifier.padding(bottom = 8.dp).align(Alignment.CenterHorizontally))
sheetContent()
Spacer(modifier = Modifier.height(GeneralUtil.getNavigationBarHeight()))
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/java/com/aliernfrog/pftool/util/GeneralUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,11 @@ import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.os.Environment
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.Dp
import androidx.core.content.ContextCompat

@Suppress("DEPRECATION")
class GeneralUtil {
companion object {
@Composable
fun getNavigationBarHeight(): Dp {
return WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
}

fun getAppVersionName(context: Context): String {
val packageManager = context.packageManager
val packageInfo = packageManager.getPackageInfo(context.packageName, 0)
Expand Down

0 comments on commit 2cb0507

Please sign in to comment.