From f07087f5a9b446b144c1fdef3742aab727b9e1b9 Mon Sep 17 00:00:00 2001 From: Ankit Suda Date: Fri, 25 Nov 2022 15:22:37 +0530 Subject: [PATCH] Fix topbar search content color --- .../java/com/ankitsuda/rebound/ui/components/TopBar.kt | 10 +++++----- .../ankitsuda/rebound/ui/exercises/ExercisesScreen.kt | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/common-ui-components/src/main/java/com/ankitsuda/rebound/ui/components/TopBar.kt b/modules/common-ui-components/src/main/java/com/ankitsuda/rebound/ui/components/TopBar.kt index ecca5925..842e21dd 100644 --- a/modules/common-ui-components/src/main/java/com/ankitsuda/rebound/ui/components/TopBar.kt +++ b/modules/common-ui-components/src/main/java/com/ankitsuda/rebound/ui/components/TopBar.kt @@ -195,6 +195,7 @@ fun TopSearchBar( leftBackBtnEnabled: Boolean = true, rightClearBtnEnabled: Boolean = true, ) { + val contentColor = LocalThemeState.current.topBarContentColor var clearBtnWidth by remember { mutableStateOf(0) @@ -219,13 +220,13 @@ fun TopSearchBar( Icon( imageVector = Icons.Outlined.ArrowBack, contentDescription = stringResource(R.string.back), - tint = /*if (backgroundColor.isDark()) Color.White else*/ ReboundTheme.colors.onBackground, + tint = contentColor, ) } // TextField TextField( colors = TextFieldDefaults.textFieldColors( - textColor = /*if (backgroundColor.isDark()) Color.White else*/ Color.Black, + textColor = contentColor, disabledTextColor = Color.Transparent, backgroundColor = Color.Transparent, focusedIndicatorColor = Color.Transparent, @@ -259,7 +260,7 @@ fun TopSearchBar( clearBtnWidth = it.parentCoordinates!!.size.width }) { Icon( - tint = /*if (backgroundColor.isDark()) Color.White else*/ Color.Black, + tint = contentColor, imageVector = Icons.Outlined.Close, contentDescription = stringResource(R.string.clear) ) @@ -279,8 +280,7 @@ fun TopBarIconButton( onClick: () -> Unit ) { val alpha by animateFloatAsState(targetValue = if (enabled) 1f else 0.5f) -// val contentColor by viewModel.contentColor.collectAsState(ReboundTheme.colors.onBackground) - val contentColor = ReboundTheme.colors.onBackground + val contentColor = LocalThemeState.current.topBarContentColor IconButton( onClick = onClick, diff --git a/modules/ui-exercises/src/main/java/com/ankitsuda/rebound/ui/exercises/ExercisesScreen.kt b/modules/ui-exercises/src/main/java/com/ankitsuda/rebound/ui/exercises/ExercisesScreen.kt index 823d5203..7a9650f2 100644 --- a/modules/ui-exercises/src/main/java/com/ankitsuda/rebound/ui/exercises/ExercisesScreen.kt +++ b/modules/ui-exercises/src/main/java/com/ankitsuda/rebound/ui/exercises/ExercisesScreen.kt @@ -157,7 +157,6 @@ private fun ExercisesScreenContent( onChangeSearchTerm(it) }, ) - } }, ) {