Skip to content

Commit eade667

Browse files
committed
Update WorkoutScreen color scheme
1 parent 5bb6e4d commit eade667

File tree

1 file changed

+33
-4
lines changed
  • feature/workout/src/main/kotlin/com/patrykandpatrick/liftapp/feature/workout/ui

1 file changed

+33
-4
lines changed

feature/workout/src/main/kotlin/com/patrykandpatrick/liftapp/feature/workout/ui/WorkoutScreen.kt

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.compose.animation.togetherWith
1313
import androidx.compose.foundation.background
1414
import androidx.compose.foundation.interaction.DragInteraction
1515
import androidx.compose.foundation.interaction.PressInteraction
16+
import androidx.compose.foundation.isSystemInDarkTheme
1617
import androidx.compose.foundation.layout.Arrangement
1718
import androidx.compose.foundation.layout.Box
1819
import androidx.compose.foundation.layout.Column
@@ -35,6 +36,7 @@ import androidx.compose.foundation.verticalScroll
3536
import androidx.compose.material3.Icon
3637
import androidx.compose.material3.Text
3738
import androidx.compose.runtime.Composable
39+
import androidx.compose.runtime.DisposableEffect
3840
import androidx.compose.runtime.LaunchedEffect
3941
import androidx.compose.runtime.State
4042
import androidx.compose.runtime.mutableIntStateOf
@@ -67,12 +69,14 @@ import com.patrykandpatrick.liftapp.ui.component.LiftAppButton
6769
import com.patrykandpatrick.liftapp.ui.component.LiftAppButtonDefaults
6870
import com.patrykandpatrick.liftapp.ui.component.LiftAppHorizontalDivider
6971
import com.patrykandpatrick.liftapp.ui.component.LiftAppScaffold
72+
import com.patrykandpatrick.liftapp.ui.component.windowInsetsControllerCompat
7073
import com.patrykandpatrick.liftapp.ui.dimens.LocalDimens
7174
import com.patrykandpatrick.liftapp.ui.dimens.dimens
7275
import com.patrykandpatrick.liftapp.ui.modifier.topTintedEdge
7376
import com.patrykandpatrick.liftapp.ui.theme.BottomSheetShape
7477
import com.patrykandpatrick.liftapp.ui.theme.ButtonBorderShape
7578
import com.patrykandpatrick.liftapp.ui.theme.ButtonShape
79+
import com.patrykandpatrick.liftapp.ui.theme.LiftAppTheme
7680
import com.patrykandpatrick.liftapp.ui.theme.bottomSheetShadow
7781
import com.patrykandpatrick.liftapp.ui.theme.colorScheme
7882
import com.patrykandpatryk.liftapp.core.R
@@ -117,6 +121,8 @@ fun WorkoutScreen(modifier: Modifier = Modifier, viewModel: WorkoutViewModel = h
117121

118122
RestTimerEffect(viewModel, restTimerService)
119123

124+
SetStatusAppearance()
125+
120126
LiftAppScaffold(
121127
topBar = {
122128
CompactTopAppBar(
@@ -130,6 +136,11 @@ fun WorkoutScreen(modifier: Modifier = Modifier, viewModel: WorkoutViewModel = h
130136
navigationIcon = {
131137
AppBars.BackArrow(onClick = { viewModel.onAction(Action.PopBackStack) })
132138
},
139+
colors =
140+
AppBars.colors(
141+
containerColor = colorScheme.bottomSheetScrim,
142+
contentColor = colorScheme.onBottomSheetScrim,
143+
),
133144
)
134145
},
135146
bottomBar = {
@@ -138,6 +149,7 @@ fun WorkoutScreen(modifier: Modifier = Modifier, viewModel: WorkoutViewModel = h
138149
}
139150
},
140151
modifier = modifier,
152+
containerColor = colorScheme.bottomSheetScrim,
141153
) { paddingValues ->
142154
if (workout != null) {
143155
Content(
@@ -189,7 +201,11 @@ private fun Content(
189201

190202
Box(modifier = modifier.imePadding()) {
191203
Backdrop(
192-
backContent = { ExerciseListPicker(workout, wheelPickerState, backdropState) },
204+
backContent = {
205+
LiftAppTheme(darkTheme = true) {
206+
ExerciseListPicker(workout, wheelPickerState, backdropState)
207+
}
208+
},
193209
backPeekHeight = { wheelPickerState.maxItemHeight.toDp() },
194210
contentPeekHeight = { 200.dp },
195211
state = backdropState,
@@ -202,7 +218,7 @@ private fun Content(
202218
.background(
203219
brush =
204220
Brush.verticalGradient(
205-
listOf(colorScheme.surface, colorScheme.background)
221+
listOf(colorScheme.surface, colorScheme.surface)
206222
),
207223
shape = BottomSheetShape,
208224
)
@@ -271,8 +287,7 @@ private fun BottomBar(
271287
val padding = LocalDimens.current.padding
272288
Column(
273289
verticalArrangement = Arrangement.spacedBy(16.dp),
274-
modifier =
275-
modifier.background(colorScheme.background).fillMaxWidth().navigationBarsPadding(),
290+
modifier = modifier.background(colorScheme.surface).fillMaxWidth().navigationBarsPadding(),
276291
) {
277292
Column {
278293
LiftAppHorizontalDivider()
@@ -442,6 +457,20 @@ private fun Page(
442457
}
443458
}
444459

460+
@Composable
461+
fun SetStatusAppearance() {
462+
val windowInsetsController = windowInsetsControllerCompat
463+
val isInDarkTheme = isSystemInDarkTheme()
464+
465+
DisposableEffect(windowInsetsController, isInDarkTheme) {
466+
windowInsetsController?.let { controller ->
467+
val initial = !isInDarkTheme
468+
controller.isAppearanceLightStatusBars = false
469+
onDispose { controller.isAppearanceLightStatusBars = initial }
470+
} ?: onDispose {}
471+
}
472+
}
473+
445474
@MultiDevicePreview
446475
@Composable
447476
private fun WorkoutScreenPreview() {

0 commit comments

Comments
 (0)