Tweak bottom sheet and preference group style

This commit is contained in:
Suphon Thanakornpakapong
2022-05-10 16:40:34 +07:00
parent 20facb6ec9
commit 1bf43b2192
3 changed files with 24 additions and 27 deletions
@@ -16,21 +16,17 @@
package app.lawnchair.ui.preferences.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import app.lawnchair.theme.surfaceColorAtElevation
import app.lawnchair.ui.theme.dividerColor
fun LazyListScope.preferenceGroupItems(
@@ -96,11 +92,10 @@ fun PreferenceGroupItem(
val bottom = if (cutBottom) 0.dp else 12.dp
RoundedCornerShape(top, top, bottom, bottom)
}
Column(
modifier = Modifier
.padding(start = 16.dp, end = 16.dp)
.clip(shape)
.background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp))
Surface(
modifier = Modifier.padding(horizontal = 16.dp),
shape = shape,
tonalElevation = 1.dp
) {
content()
}
@@ -21,7 +21,9 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.LocalAbsoluteTonalElevation
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@@ -46,21 +48,22 @@ fun PreferenceGroup(
) {
Column {
PreferenceGroupHeading(heading, isFirstChild)
val columnModifier = Modifier
.padding(horizontal = 16.dp)
.clip(shape = MaterialTheme.shapes.large)
.background(Material3Theme.colorScheme.surfaceColorAtElevation(1.dp))
if (showDividers) {
DividerColumn(
modifier = columnModifier,
startIndent = dividerStartIndent,
endIndent = dividerEndIndent,
content = content,
dividersToSkip = dividersToSkip
)
} else {
Column(modifier = columnModifier) {
content()
Surface(
modifier = Modifier.padding(horizontal = 16.dp),
shape = MaterialTheme.shapes.large,
tonalElevation = 1.dp
) {
if (showDividers) {
DividerColumn(
startIndent = dividerStartIndent,
endIndent = dividerEndIndent,
content = content,
dividersToSkip = dividersToSkip
)
} else {
Column {
content()
}
}
}
PreferenceGroupDescription(description, showDescription)
@@ -213,8 +213,7 @@ class ComposeBottomSheet<T>(context: Context)
modifier = Modifier
.fillMaxWidth(),
shape = backgroundShape,
color = Material3Theme.colorScheme.surface,
tonalElevation = 3.dp
color = Material3Theme.colorScheme.background
) {
Box(
modifier = Modifier