mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-11-04 10:13:59 +00:00
feat(ui): update MillenniumModalBottomSheet with compact padding and spacing adjustments
This commit is contained in:
parent
c57e33fe0d
commit
59f1b82368
@ -40,7 +40,6 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import com.composeunstyled.SheetDetent
|
import com.composeunstyled.SheetDetent
|
||||||
import com.composeunstyled.rememberModalBottomSheetState
|
import com.composeunstyled.rememberModalBottomSheetState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -94,10 +93,7 @@ fun AdaptiveDialogBottomSheet(
|
|||||||
}
|
}
|
||||||
MillenniumModalBottomSheet(state = sheetState) {
|
MillenniumModalBottomSheet(state = sheetState) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp)
|
|
||||||
.padding(top = 16.dp),
|
|
||||||
horizontalAlignment = Alignment.Start) {
|
horizontalAlignment = Alignment.Start) {
|
||||||
title?.let {
|
title?.let {
|
||||||
Row(
|
Row(
|
||||||
@ -130,7 +126,6 @@ fun AdaptiveDialogBottomSheet(
|
|||||||
it()
|
it()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer(Modifier.height(24.dp))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
@ -165,7 +166,10 @@ private fun AdaptiveBottomSheetContent(
|
|||||||
onDismiss()
|
onDismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MillenniumModalBottomSheet(state = sheetState) {
|
MillenniumModalBottomSheet(
|
||||||
|
state = sheetState,
|
||||||
|
contentPadding = PaddingValues(top = 10.dp, bottom = 8.dp),
|
||||||
|
contentSpacing = 4.dp) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth()) {
|
modifier = Modifier.fillMaxWidth()) {
|
||||||
header?.invoke()
|
header?.invoke()
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
|
||||||
@ -144,7 +145,10 @@ fun TrackOptionsBottomSheet(
|
|||||||
onDismiss()
|
onDismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MillenniumModalBottomSheet(state = sheetState) {
|
MillenniumModalBottomSheet(
|
||||||
|
state = sheetState,
|
||||||
|
contentPadding = PaddingValues(top = 10.dp, bottom = 8.dp),
|
||||||
|
contentSpacing = 4.dp) {
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
TrackOptionsSheetHeader(track = track)
|
TrackOptionsSheetHeader(track = track)
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
package dev.krtirtho.spotube.core.ui.theming
|
package dev.krtirtho.spotube.core.ui.theming
|
||||||
|
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
@ -35,9 +36,11 @@ import androidx.compose.ui.unit.sp
|
|||||||
|
|
||||||
import dev.krtirtho.spotube.modules.settings.Theme
|
import dev.krtirtho.spotube.modules.settings.Theme
|
||||||
import dev.krtirtho.spotube.modules.settings.UserSettings
|
import dev.krtirtho.spotube.modules.settings.UserSettings
|
||||||
|
import org.spotube.millennium.composables.MillenniumModalBottomSheetTheme
|
||||||
import org.spotube.millennium.composables.MillenniumTooltipHost
|
import org.spotube.millennium.composables.MillenniumTooltipHost
|
||||||
import org.spotube.millennium.composables.MillenniumTopAppBarTheme
|
import org.spotube.millennium.composables.MillenniumTopAppBarTheme
|
||||||
import org.spotube.millennium.composables.MillenniumTopAppBarThemeProperties
|
import org.spotube.millennium.composables.MillenniumTopAppBarThemeProperties
|
||||||
|
import org.spotube.millennium.composables.defaultMillenniumModalBottomSheetTheme
|
||||||
import org.spotube.millennium.composables.defaultMillenniumTopAppBarTheme
|
import org.spotube.millennium.composables.defaultMillenniumTopAppBarTheme
|
||||||
import org.spotube.millennium.theme.MillenniumColors
|
import org.spotube.millennium.theme.MillenniumColors
|
||||||
import org.spotube.millennium.theme.MillenniumDarkThemeComponents
|
import org.spotube.millennium.theme.MillenniumDarkThemeComponents
|
||||||
@ -218,14 +221,16 @@ fun SpotubeTheme(
|
|||||||
properties = darkTheme.topAppBarTheme.properties.copy(
|
properties = darkTheme.topAppBarTheme.properties.copy(
|
||||||
separatorColor = Color.Transparent
|
separatorColor = Color.Transparent
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
modalBottomSheetTheme = compactModalBottomSheetTheme()
|
||||||
),
|
),
|
||||||
light = lightTheme.copy(
|
light = lightTheme.copy(
|
||||||
topAppBarTheme = MillenniumTopAppBarTheme(
|
topAppBarTheme = MillenniumTopAppBarTheme(
|
||||||
properties = lightTheme.topAppBarTheme.properties.copy(
|
properties = lightTheme.topAppBarTheme.properties.copy(
|
||||||
separatorColor = Color.Transparent
|
separatorColor = Color.Transparent
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
modalBottomSheetTheme = compactModalBottomSheetTheme()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -241,6 +246,23 @@ fun SpotubeTheme(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Library default is 24dp padding + 16dp spacing, which is far too roomy on phones. */
|
||||||
|
private fun compactModalBottomSheetTheme(): MillenniumModalBottomSheetTheme {
|
||||||
|
val padding = PaddingValues(start = 16.dp, end = 16.dp, top = 10.dp, bottom = 8.dp)
|
||||||
|
fun org.spotube.millennium.composables.MillenniumModalBottomSheetThemeProperties.compact() =
|
||||||
|
copy(contentPadding = padding, contentSpacing = 8.dp)
|
||||||
|
val states = defaultMillenniumModalBottomSheetTheme().states
|
||||||
|
return MillenniumModalBottomSheetTheme(
|
||||||
|
states = org.spotube.millennium.theme.MillenniumControlStateProperty(
|
||||||
|
default = states.default.compact(),
|
||||||
|
hovered = states.hovered.compact(),
|
||||||
|
focused = states.focused.compact(),
|
||||||
|
pressed = states.pressed.compact(),
|
||||||
|
disabled = states.disabled.compact(),
|
||||||
|
selected = states.selected.compact(),
|
||||||
|
error = states.error.compact()))
|
||||||
|
}
|
||||||
|
|
||||||
/** Whether the active Millennium appearance is light. */
|
/** Whether the active Millennium appearance is light. */
|
||||||
@Composable
|
@Composable
|
||||||
fun isLightAppearance(): Boolean = MillenniumTheme.colors.background.luminance() > 0.5f
|
fun isLightAppearance(): Boolean = MillenniumTheme.colors.background.luminance() > 0.5f
|
||||||
|
|||||||
@ -289,7 +289,8 @@ fun AppExpandedPlayer(
|
|||||||
if (playerOptionsUiState.isMoreOptionsSheetOpen) {
|
if (playerOptionsUiState.isMoreOptionsSheetOpen) {
|
||||||
MillenniumModalBottomSheet(
|
MillenniumModalBottomSheet(
|
||||||
state = moreOptionsSheetState,
|
state = moreOptionsSheetState,
|
||||||
contentPadding = PaddingValues(horizontal = 0.dp, vertical = 8.dp)
|
contentPadding = PaddingValues(horizontal = 0.dp, vertical = 8.dp),
|
||||||
|
contentSpacing = 4.dp
|
||||||
) {
|
) {
|
||||||
// Grid of Options
|
// Grid of Options
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
|
|||||||
@ -99,7 +99,8 @@ internal fun BottomSheetContent(
|
|||||||
}
|
}
|
||||||
MillenniumModalBottomSheet(
|
MillenniumModalBottomSheet(
|
||||||
state = sheetState,
|
state = sheetState,
|
||||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp)
|
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||||
|
contentSpacing = 8.dp
|
||||||
) {
|
) {
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user