forked from cl3m/multiplatform-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dark mode and device orientation
- Loading branch information
Showing
6 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
test/src/commonMain/kotlin/com/rouge41/kmm/compose/test/Content.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
package com.rouge41.kmm.compose.test | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.compositionLocalOf | ||
import androidx.compose.runtime.mutableStateOf | ||
import io.ktor.client.* | ||
import io.ktor.client.call.* | ||
import io.ktor.client.request.* | ||
import io.ktor.utils.io.core.* | ||
|
||
internal val darkmodeState = mutableStateOf(false) | ||
internal val safeAreaState = mutableStateOf(PaddingValues()) | ||
internal val SafeArea = compositionLocalOf { safeAreaState } | ||
internal val DarkMode = compositionLocalOf { darkmodeState } | ||
|
||
@Composable | ||
internal fun Content() { | ||
Theme { | ||
App() | ||
} | ||
// isSystemInDarkTheme is not working correctly on iOS | ||
val darkMode = isSystemInDarkTheme() | ||
LaunchedEffect(key1 = Unit, block = { | ||
darkmodeState.value = darkMode | ||
}) | ||
} |
7 changes: 3 additions & 4 deletions
7
test/src/commonMain/kotlin/com/rouge41/kmm/compose/test/Theme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters