Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 1b936f6

Browse files
committed
feat(compose): add some multipreview annotations
1 parent 3266a1b commit 1b936f6

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

ui/compose/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ dependencies {
2424
api(libs.compose.material3)
2525
api(libs.compose.ui.core)
2626
implementation(libs.androidx.core.ktx)
27+
implementation(libs.compose.ui.tooling)
2728
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package app.passwordstore.ui.compose.preview
2+
3+
import android.content.res.Configuration
4+
import androidx.compose.ui.tooling.preview.Preview
5+
6+
/**
7+
* Multipreview annotation that represents light and dark themes. Add this annotation to a
8+
* composable to render the both themes.
9+
*/
10+
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light theme")
11+
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark theme")
12+
public annotation class ThemePreviews
13+
14+
/**
15+
* Multipreview annotation that represents various device sizes. Add this annotation to a composable
16+
* to render various devices.
17+
*/
18+
@Preview(name = "phone", device = "spec:shape=Normal,width=360,height=640,unit=dp,dpi=480")
19+
@Preview(name = "landscape", device = "spec:shape=Normal,width=640,height=360,unit=dp,dpi=480")
20+
@Preview(name = "foldable", device = "spec:shape=Normal,width=673,height=841,unit=dp,dpi=480")
21+
@Preview(name = "tablet", device = "spec:shape=Normal,width=1280,height=800,unit=dp,dpi=480")
22+
public annotation class DevicePreviews

0 commit comments

Comments
 (0)