1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-10 17:30:31 +00:00

Fix content color in comment replies fragment

This commit is contained in:
Stypox 2024-11-11 00:29:29 +01:00
parent 23b3835af0
commit ef56dea817
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -6,10 +6,13 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
@ -67,6 +70,12 @@ private fun CommentRepliesDialog(
val state = rememberLazyListState()
ModalBottomSheet(onDismissRequest = onDismissRequest) {
CompositionLocalProvider(
// contentColorFor(MaterialTheme.colorScheme.containerColor), i.e. ModalBottomSheet's
// default background color, does not resolve correctly, so need to manually set the
// content color for MaterialTheme.colorScheme.background instead
LocalContentColor provides contentColorFor(MaterialTheme.colorScheme.background)
) {
LazyColumnScrollbar(
state = state,
settings = ScrollbarSettings.Default.copy(
@ -104,7 +113,10 @@ private fun CommentRepliesDialog(
if (comments.itemCount >= 0) {
item {
Text(
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
modifier = Modifier.padding(
horizontal = 12.dp,
vertical = 4.dp
),
text = pluralStringResource(
R.plurals.replies, comments.itemCount, comments.itemCount
),
@ -121,6 +133,7 @@ private fun CommentRepliesDialog(
}
}
}
}
@Preview(name = "Light mode", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(name = "Dark mode", uiMode = Configuration.UI_MODE_NIGHT_YES)