Skip to content

Commit e61f375

Browse files
committed
example: Opt haze style
1 parent 2daf543 commit e61f375

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

composeApp/build.gradle.kts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,13 @@ tasks.register<Exec>("assembleMiuixMacosArm64ReleaseBinary") {
218218
commandLine("lipo", "-create", "-output", "Miuix_macOSArm64", "bin/macosArm64/releaseExecutable/Miuix.kexe")
219219
workingDir = layout.buildDirectory.get().asFile
220220
group = "macos native"
221-
description = "Build macOS Arm64 binary"
221+
description = "Build macOS Arm64 Binary"
222222
}
223223

224224
tasks.register<Exec>("assembleMiuixMacosX64ReleaseBinary") {
225225
dependsOn(":composeApp:desktopTest", ":composeApp:linkReleaseExecutableMacosX64")
226226
commandLine("lipo", "-create", "-output", "Miuix_macOSX64", "bin/macosX64/releaseExecutable/Miuix.kexe")
227227
workingDir = layout.buildDirectory.get().asFile
228228
group = "macos native"
229-
description = "Build macOS X64 binary"
230-
}
231-
232-
tasks.register<Exec>("assembleMiuixMacosUniversalReleaseBinary") {
233-
dependsOn(":composeApp:desktopTest", ":composeApp:linkReleaseExecutableMacosX64", ":composeApp:linkReleaseExecutableMacosArm64")
234-
commandLine("lipo", "-create", "-output", "Miuix_macOS", "bin/macosX64/releaseExecutable/Miuix.kexe", "bin/macosArm64/releaseExecutable/Miuix.kexe")
235-
workingDir = layout.buildDirectory.get().asFile
236-
group = "macos native"
237-
description = "Build macOS universal binary"
229+
description = "Build macOS X64 Binary"
238230
}

composeApp/src/commonMain/kotlin/UITest.kt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ fun UITest(
107107
val hazeState = remember { HazeState() }
108108

109109
val hazeStyleTopBar = HazeStyle(
110-
backgroundColor = if (currentScrollBehavior.state.heightOffset > -1) Color.Transparent else MiuixTheme.colorScheme.background,
110+
backgroundColor = MiuixTheme.colorScheme.background,
111111
tint = HazeTint(
112112
MiuixTheme.colorScheme.background.copy(
113-
if (currentScrollBehavior.state.heightOffset > -1) 1f
114-
else lerp(1f, 0.67f, (currentScrollBehavior.state.heightOffset + 1) / -143f)
113+
if (currentScrollBehavior.state.collapsedFraction <= 0f) 1f
114+
else lerp(1f, 0.67f, (currentScrollBehavior.state.collapsedFraction))
115115
)
116116
)
117117
)
118118

119-
val hazeStyleBottomBar = HazeStyle(
119+
val hazeStyle = HazeStyle(
120120
backgroundColor = MiuixTheme.colorScheme.background,
121121
tint = HazeTint(MiuixTheme.colorScheme.background.copy(0.67f))
122122
)
@@ -143,17 +143,15 @@ fun UITest(
143143
enter = fadeIn() + expandVertically(),
144144
exit = fadeOut() + shrinkVertically()
145145
) {
146-
BoxWithConstraints(
147-
modifier = Modifier
148-
.hazeEffect(hazeState) {
149-
style = hazeStyleTopBar
150-
blurRadius = 25.dp
151-
noiseFactor = 0f
152-
}
153-
) {
146+
BoxWithConstraints {
154147
if (maxWidth > 840.dp) {
155148
SmallTopAppBar(
156149
title = "Miuix",
150+
modifier = Modifier.hazeEffect(state = hazeState) {
151+
style = hazeStyle
152+
blurRadius = 25.dp
153+
noiseFactor = 0f
154+
},
157155
scrollBehavior = currentScrollBehavior,
158156
color = Color.Transparent,
159157
actions = {
@@ -205,6 +203,12 @@ fun UITest(
205203
} else {
206204
TopAppBar(
207205
title = "Miuix",
206+
modifier = Modifier
207+
.hazeEffect(state = hazeState) {
208+
style = hazeStyleTopBar
209+
blurRadius = 25.dp
210+
noiseFactor = 0f
211+
},
208212
scrollBehavior = currentScrollBehavior,
209213
color = Color.Transparent,
210214
actions = {
@@ -297,7 +301,7 @@ fun UITest(
297301
NavigationBar(
298302
modifier = Modifier
299303
.hazeEffect(hazeState) {
300-
style = hazeStyleBottomBar
304+
style = hazeStyle
301305
blurRadius = 25.dp
302306
noiseFactor = 0f
303307
},

0 commit comments

Comments
 (0)