Delete composeApp/src/commonMain/kotlin/com/nuvio/app/core/ui/NuvioBottomSheet.kt

This commit is contained in:
AdityasahuX07 2026-04-25 15:38:20 +05:30 committed by GitHub
parent fe953fda39
commit 9da6dc6b83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,132 +0,0 @@
package com.nuvio.app.core.ui
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
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.graphics.vector.ImageVector
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NuvioModalBottomSheet(
onDismissRequest: () -> Unit,
sheetState: SheetState,
modifier: Modifier = Modifier,
containerColor: Color = MaterialTheme.colorScheme.surface,
contentColor: Color = MaterialTheme.colorScheme.onSurface,
shape: Shape = RoundedCornerShape(topStart = 28.dp, topEnd = 28.dp),
showDragHandle: Boolean = true,
content: @Composable ColumnScope.() -> Unit,
) {
ModalBottomSheet(
onDismissRequest = onDismissRequest,
sheetState = sheetState,
modifier = modifier,
containerColor = containerColor,
contentColor = contentColor,
shape = shape,
dragHandle = if (showDragHandle) {
{ NuvioBottomSheetDragHandle() }
} else {
null
},
content = content,
)
}
@Composable
fun NuvioBottomSheetDivider(
modifier: Modifier = Modifier,
) {
HorizontalDivider(
modifier = modifier,
color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.6f),
)
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun NuvioBottomSheetActionRow(
title: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
icon: ImageVector? = null,
trailingContent: (@Composable RowScope.() -> Unit)? = null,
) {
Row(
modifier = modifier
.fillMaxWidth()
.combinedClickable(
onClick = onClick,
onLongClick = onLongClick,
)
.padding(horizontal = 16.dp, vertical = 16.dp),
horizontalArrangement = Arrangement.spacedBy(14.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (icon != null) {
Icon(
imageVector = icon,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(22.dp),
)
}
Text(
text = title,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
trailingContent?.invoke(this)
}
}
@OptIn(ExperimentalMaterial3Api::class)
suspend fun dismissNuvioBottomSheet(
sheetState: SheetState,
onDismiss: () -> Unit,
) {
if (sheetState.isVisible) {
sheetState.hide()
}
onDismiss()
}
@Composable
private fun NuvioBottomSheetDragHandle() {
Box(
modifier = Modifier
.padding(top = 10.dp, bottom = 6.dp)
.size(width = 54.dp, height = 5.dp)
.clip(RoundedCornerShape(999.dp))
.background(MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.65f)),
)
}