From d47098d019be6f4546a3100c3f2e1ab978854547 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 4 Feb 2025 19:56:52 +0530 Subject: [PATCH] refactor(common): improve multipreview annotations --- .../common/ui/preview/PreviewAnnotations.kt | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt index 2c92d721..7c257201 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt @@ -13,16 +13,26 @@ import androidx.compose.ui.tooling.preview.Preview * Multipreview annotation that represents light and dark themes. Add this annotation to a * composable to render the both themes. */ -@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light theme") -@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark theme") +@Preview( + uiMode = Configuration.UI_MODE_NIGHT_NO, + name = "Light theme", + showBackground = true, + backgroundColor = 0xFFFFFF, +) +@Preview( + uiMode = Configuration.UI_MODE_NIGHT_YES, + name = "Dark theme", + showBackground = true, + backgroundColor = 0x000000, +) annotation class ThemePreviews /** * Multipreview annotation that represents various device sizes. Add this annotation to a composable * to render various devices. */ -@Preview(name = "phone", device = "spec:shape=Normal,width=360,height=640,unit=dp,dpi=480") -@Preview(name = "landscape", device = "spec:shape=Normal,width=640,height=360,unit=dp,dpi=480") -@Preview(name = "foldable", device = "spec:shape=Normal,width=673,height=841,unit=dp,dpi=480") -@Preview(name = "tablet", device = "spec:shape=Normal,width=1280,height=800,unit=dp,dpi=480") +@Preview(name = "phone", device = "spec:width=360dp,height=640dp,dpi=480") +@Preview(name = "landscape", device = "spec:width=640dp,height=360dp,dpi=480") +@Preview(name = "foldable", device = "spec:width=673dp,height=841dp,dpi=480") +@Preview(name = "tablet", device = "spec:width=1280dp,height=800dp,dpi=480") annotation class DevicePreviews