Set PlayerBottomSheet height as percentage of max height
This commit is contained in:
parent
10b8c66887
commit
18362e99b0
3 changed files with 7 additions and 7 deletions
|
@ -26,7 +26,6 @@ object Dimensions {
|
|||
}
|
||||
|
||||
val collapsedPlayer = 64.dp
|
||||
val playerBottomSheetPeekHeight = 128.dp
|
||||
}
|
||||
|
||||
inline val Dp.px: Int
|
||||
|
|
|
@ -18,6 +18,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import it.vfsfitvnm.vimusic.Database
|
||||
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
|
||||
|
@ -27,7 +28,6 @@ import it.vfsfitvnm.vimusic.ui.components.BottomSheet
|
|||
import it.vfsfitvnm.vimusic.ui.components.BottomSheetState
|
||||
import it.vfsfitvnm.vimusic.ui.components.HorizontalTabPager
|
||||
import it.vfsfitvnm.vimusic.ui.components.rememberTabPagerState
|
||||
import it.vfsfitvnm.vimusic.ui.styling.Dimensions
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalColorPalette
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalTypography
|
||||
import it.vfsfitvnm.vimusic.utils.PlayerState
|
||||
|
@ -44,6 +44,7 @@ import kotlinx.coroutines.withContext
|
|||
fun PlayerBottomSheet(
|
||||
playerState: PlayerState?,
|
||||
layoutState: BottomSheetState,
|
||||
padding: Dp,
|
||||
song: Song?,
|
||||
onGlobalRouteEmitted: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
|
@ -61,11 +62,12 @@ fun PlayerBottomSheet(
|
|||
|
||||
BottomSheet(
|
||||
state = layoutState,
|
||||
peekHeight = Dimensions.playerBottomSheetPeekHeight,
|
||||
peekHeight = padding,
|
||||
elevation = 16.dp,
|
||||
shape = RoundedCornerShape(topStart = 8.dp, topEnd = 8.dp),
|
||||
handleOutsideInteractionsWhenExpanded = true,
|
||||
modifier = modifier,
|
||||
modifier = modifier
|
||||
.padding(bottom = padding),
|
||||
collapsedContent = {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.SpaceEvenly,
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.text.format.DateUtils
|
|||
import android.text.format.Formatter
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.LocalActivityResultRegistryOwner
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.Image
|
||||
|
@ -642,11 +641,11 @@ fun PlayerView(
|
|||
|
||||
PlayerBottomSheet(
|
||||
playerState = playerState,
|
||||
layoutState = rememberBottomSheetState(64.dp, layoutState.upperBound - Dimensions.playerBottomSheetPeekHeight),
|
||||
layoutState = rememberBottomSheetState(64.dp, layoutState.upperBound * 0.9f),
|
||||
onGlobalRouteEmitted = layoutState.collapse,
|
||||
padding = layoutState.upperBound * 0.1f,
|
||||
song = song,
|
||||
modifier = Modifier
|
||||
.padding(bottom = Dimensions.playerBottomSheetPeekHeight)
|
||||
.align(Alignment.BottomCenter)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue