Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Jetsurvey] Setting correct border and background colors
  • Loading branch information
florina-muntenescu committed Nov 2, 2020
commit 8cec9845cd6c15f7b31854d9226eb85a0c69d8aa
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import androidx.compose.ui.unit.dp
import androidx.ui.tooling.preview.Preview
import com.example.compose.jetsurvey.R
import com.example.compose.jetsurvey.theme.JetsurveyTheme
import com.example.compose.jetsurvey.theme.questionBackground

@Composable
fun Question(
Expand All @@ -67,9 +66,14 @@ fun Question(
contentPadding = PaddingValues(start = 20.dp, end = 20.dp)
) {
Spacer(modifier = Modifier.preferredHeight(44.dp))
val backgroundColor = if (MaterialTheme.colors.isLight) {
MaterialTheme.colors.onSurface.copy(alpha = 0.04f)
} else {
MaterialTheme.colors.onSurface.copy(alpha = 0.06f)
}
Row(
modifier = Modifier.fillMaxWidth().background(
color = MaterialTheme.colors.questionBackground,
color = backgroundColor,
shape = MaterialTheme.shapes.small
)
) {
Expand Down Expand Up @@ -160,7 +164,7 @@ private fun SingleChoiceQuestion(
shape = MaterialTheme.shapes.small,
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colors.surface.copy(alpha = 0.12f)
color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
),
modifier = Modifier.padding(vertical = 8.dp)
) {
Expand Down Expand Up @@ -210,7 +214,7 @@ private fun MultipleChoiceQuestion(
shape = MaterialTheme.shapes.small,
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colors.surface.copy(alpha = 0.12f)
color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
),
modifier = Modifier.padding(vertical = 4.dp)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ val Colors.snackbarAction: Color
val Colors.progressIndicatorBackground: Color
get() = if (isLight) Color.Black.copy(alpha = 0.12f) else Color.Black.copy(alpha = 0.24f)

@Composable
val Colors.questionBackground: Color
get() = if (isLight) Gray100 else Gray900

@Composable
fun JetsurveyTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
val colors = if (darkTheme) {
Expand Down