Configure dark theme on current screens

- Show light and dark screen previews for current composables
This commit is contained in:
Severiano Jaramillo 2024-03-06 19:43:58 -06:00
parent d87431bce2
commit 3368f38a45
3 changed files with 32 additions and 4 deletions

View file

@ -6,6 +6,8 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults.topAppBarColors import androidx.compose.material3.TopAppBarDefaults.topAppBarColors
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import org.jetbrains.compose.ui.tooling.preview.Preview
import ui.theme.KeeTheme
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@ -22,3 +24,15 @@ fun KeeTopAppBar(
} }
) )
} }
@Preview
@Composable
private fun TopAppBarLightPreview() = KeeTheme(useDarkTheme = false) {
KeeTopAppBar("Kee Wallet")
}
@Preview
@Composable
private fun TopAppBarDarkPreview() = KeeTheme(useDarkTheme = true) {
KeeTopAppBar("Kee Wallet")
}

View file

@ -13,11 +13,12 @@ import net.agorise.kee.getPlatform
import net.agorise.kee.ui.component.topappbar.KeeTopAppBar import net.agorise.kee.ui.component.topappbar.KeeTopAppBar
import net.agorise.kee.ui.screen.importaccount.ImportAccountScreen import net.agorise.kee.ui.screen.importaccount.ImportAccountScreen
import org.jetbrains.compose.ui.tooling.preview.Preview import org.jetbrains.compose.ui.tooling.preview.Preview
import ui.theme.KeeTheme
class HomeScreen : Screen { class HomeScreen : Screen {
@Composable @Composable
override fun Content() { override fun Content() = KeeTheme {
HomeScreenContent() HomeScreenContent()
} }
} }
@ -46,6 +47,12 @@ private fun HomeScreenContent() {
@Preview @Preview
@Composable @Composable
private fun HomeScreenContentPreview() { private fun HomeScreenContentLightPreview() = KeeTheme(useDarkTheme = false) {
HomeScreenContent()
}
@Preview
@Composable
private fun HomeScreenContentDarkPreview() = KeeTheme(useDarkTheme = true) {
HomeScreenContent() HomeScreenContent()
} }

View file

@ -15,11 +15,12 @@ import net.agorise.kee.ui.screen.home.HomeScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.vectorResource import org.jetbrains.compose.resources.vectorResource
import org.jetbrains.compose.ui.tooling.preview.Preview import org.jetbrains.compose.ui.tooling.preview.Preview
import ui.theme.KeeTheme
class ImportAccountScreen : Screen { class ImportAccountScreen : Screen {
@Composable @Composable
override fun Content() { override fun Content() = KeeTheme {
ImportAccountScreenContent() ImportAccountScreenContent()
} }
} }
@ -65,6 +66,12 @@ private fun ImportAccountScreenContent() {
@Preview @Preview
@Composable @Composable
private fun ImportAccountScreenContentPreview() { private fun ImportAccountScreenContentLightPreview() = KeeTheme(useDarkTheme = false) {
ImportAccountScreenContent()
}
@Preview
@Composable
private fun ImportAccountScreenContentDarkPreview() = KeeTheme(useDarkTheme = true) {
ImportAccountScreenContent() ImportAccountScreenContent()
} }