Skip to content

Commit

Permalink
Set the legacy MaterialTheme in order for the book bottom sheet to su…
Browse files Browse the repository at this point in the history
…pport the dark mode.
  • Loading branch information
PaulWoitaschek committed Jul 10, 2022
1 parent b2c0c85 commit 4931ded
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material.rememberModalBottomSheetState
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -78,16 +79,18 @@ fun BookOverviewScreen(
ModalBottomSheetLayout(
sheetState = bottomSheetState,
sheetContent = {
BottomSheetContent { item ->
scope.launch {
delay(300)
bottomSheetState.hide()
when (item) {
BottomSheetItem.Title -> {
editingBook?.let(editBookTitleViewModel::onEditBookTitleClick)
Surface {
BottomSheetContent { item ->
scope.launch {
delay(300)
bottomSheetState.hide()
when (item) {
BottomSheetItem.Title -> {
editingBook?.let(editBookTitleViewModel::onEditBookTitleClick)
}
BottomSheetItem.InternetCover -> editingBook?.let(onCoverFromInternetClick)
BottomSheetItem.FileCover -> editingBook?.let(onFileCoverClick)
}
BottomSheetItem.InternetCover -> editingBook?.let(onCoverFromInternetClick)
BottomSheetItem.FileCover -> editingBook?.let(onFileCoverClick)
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions common/src/main/kotlin/voice/common/compose/VoiceTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package voice.common.compose

import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
Expand Down Expand Up @@ -33,9 +36,16 @@ fun VoiceTheme(
lightColorScheme()
}
}

) {
content()
MaterialTheme(
colors = if (isDarkTheme()) {
darkColors()
} else {
lightColors()
}
) {
content()
}
}
}

Expand Down

0 comments on commit 4931ded

Please sign in to comment.