Skip to content

Commit 500119b

Browse files
committed
example: commonize @Preview
1 parent e6b7a8c commit 500119b

File tree

6 files changed

+31
-111
lines changed

6 files changed

+31
-111
lines changed

.idea/runConfigurations/iosApp.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/build.gradle.kts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ kotlin {
106106
implementation(compose.foundation)
107107
implementation(compose.ui)
108108
implementation(compose.components.resources)
109-
109+
implementation(compose.components.uiToolingPreview)
110110
implementation(project(":miuix"))
111111
}
112112
desktopMain.dependencies {
@@ -115,11 +115,6 @@ kotlin {
115115
}
116116
}
117117

118-
dependencies {
119-
implementation(compose.preview)
120-
debugImplementation(compose.uiTooling)
121-
}
122-
123118
android {
124119
namespace = pkgName
125120
defaultConfig {
@@ -152,7 +147,13 @@ android {
152147
}
153148
}
154149
}
155-
dependenciesInfo.includeInApk = false
150+
dependencies {
151+
debugImplementation(compose.uiTooling)
152+
}
153+
dependenciesInfo {
154+
includeInApk = false
155+
includeInBundle = false
156+
}
156157
packaging {
157158
applicationVariants.all {
158159
outputs.all {

example/src/androidMain/kotlin/Preview.android.kt renamed to example/src/commonMain/kotlin/preview/Preview.kt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025, miuix-kotlin-multiplatform contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package top.yukonga.miuix.uitest
4+
package preview
55

66
import App
77
import FourthPage
@@ -12,13 +12,13 @@ import androidx.compose.foundation.layout.PaddingValues
1212
import androidx.compose.runtime.Composable
1313
import androidx.compose.runtime.mutableIntStateOf
1414
import androidx.compose.runtime.remember
15-
import androidx.compose.ui.tooling.preview.Preview
15+
import org.jetbrains.compose.ui.tooling.preview.Preview
1616
import top.yukonga.miuix.kmp.basic.MiuixScrollBehavior
1717
import top.yukonga.miuix.kmp.basic.Scaffold
1818
import ui.AppTheme
1919

2020
@Composable
21-
@Preview(device = "spec:width=1200px,height=2670px,dpi=480")
21+
@Preview
2222
fun UITestPreview() {
2323
AppTheme {
2424
Scaffold {
@@ -28,7 +28,7 @@ fun UITestPreview() {
2828
}
2929

3030
@Composable
31-
@Preview(device = "spec:width=1200px,height=2670px,dpi=480")
31+
@Preview
3232
fun MainPagePreview() {
3333
AppTheme {
3434
Scaffold {
@@ -38,27 +38,35 @@ fun MainPagePreview() {
3838
}
3939

4040
@Composable
41-
@Preview(device = "spec:width=1200px,height=2670px,dpi=480")
41+
@Preview
4242
fun SecondPagePreview() {
4343
AppTheme {
4444
Scaffold {
45-
SecondPage(MiuixScrollBehavior(), PaddingValues(), true)
45+
SecondPage(
46+
MiuixScrollBehavior(),
47+
PaddingValues(),
48+
true
49+
)
4650
}
4751
}
4852
}
4953

5054
@Composable
51-
@Preview(device = "spec:width=1200px,height=2670px,dpi=480")
55+
@Preview
5256
fun ThirdPagePreview() {
5357
AppTheme {
5458
Scaffold {
55-
ThirdPage(MiuixScrollBehavior(), PaddingValues(), true)
59+
ThirdPage(
60+
MiuixScrollBehavior(),
61+
PaddingValues(),
62+
true
63+
)
5664
}
5765
}
5866
}
5967

6068
@Composable
61-
@Preview(device = "spec:width=1200px,height=2670px,dpi=480")
69+
@Preview
6270
fun FourthPagePreview() {
6371
AppTheme {
6472
Scaffold {

example/src/desktopMain/kotlin/Preview.desktop.kt

Lines changed: 0 additions & 93 deletions
This file was deleted.

iosApp/iosApp.xcodeproj/xcshareddata/xcschemes/iosApp.xcscheme

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
isEnabled = "YES">
6767
</AdditionalOption>
6868
</AdditionalOptions>
69+
<LocationScenarioReference
70+
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
71+
referenceType = "1">
72+
</LocationScenarioReference>
6973
</LaunchAction>
7074
<ProfileAction
7175
buildConfiguration = "Release"

iosApp/iosApp/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundleShortVersionString</key>
1818
<string>1.0.4</string>
1919
<key>CFBundleVersion</key>
20-
<string>544</string>
20+
<string>545</string>
2121
<key>LSRequiresIPhoneOS</key>
2222
<true/>
2323
<key>CADisableMinimumFrameDurationOnPhone</key>

0 commit comments

Comments
 (0)