@@ -30,6 +30,12 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
3030import androidx.compose.ui.platform.LocalHapticFeedback
3131import androidx.compose.ui.platform.LocalUriHandler
3232import androidx.compose.ui.unit.dp
33+ import androidx.compose.ui.util.lerp
34+ import dev.chrisbanes.haze.HazeState
35+ import dev.chrisbanes.haze.HazeStyle
36+ import dev.chrisbanes.haze.HazeTint
37+ import dev.chrisbanes.haze.hazeEffect
38+ import dev.chrisbanes.haze.hazeSource
3339import kotlinx.coroutines.FlowPreview
3440import kotlinx.coroutines.flow.collectLatest
3541import kotlinx.coroutines.flow.debounce
@@ -58,6 +64,7 @@ import top.yukonga.miuix.kmp.icon.icons.useful.More
5864import top.yukonga.miuix.kmp.icon.icons.useful.NavigatorSwitch
5965import top.yukonga.miuix.kmp.icon.icons.useful.Order
6066import top.yukonga.miuix.kmp.icon.icons.useful.Settings
67+ import top.yukonga.miuix.kmp.theme.MiuixTheme
6168import top.yukonga.miuix.kmp.utils.MiuixPopupUtils.Companion.dismissPopup
6269import utils.FPSMonitor
6370
@@ -97,6 +104,23 @@ fun UITest(
97104 }
98105 }
99106
107+ val hazeState = remember { HazeState () }
108+
109+ val hazeStyleTopBar = HazeStyle (
110+ backgroundColor = if (currentScrollBehavior.state.heightOffset > - 1 ) Color .Transparent else MiuixTheme .colorScheme.background,
111+ tint = HazeTint (
112+ MiuixTheme .colorScheme.background.copy(
113+ if (currentScrollBehavior.state.heightOffset > - 1 ) 1f
114+ else lerp(1f , 0.67f , (currentScrollBehavior.state.heightOffset + 1 ) / - 143f )
115+ )
116+ )
117+ )
118+
119+ val hazeStyleBottomBar = HazeStyle (
120+ backgroundColor = MiuixTheme .colorScheme.background,
121+ tint = HazeTint (MiuixTheme .colorScheme.background.copy(0.67f ))
122+ )
123+
100124 val showFPSMonitor = remember { mutableStateOf(false ) }
101125 val showTopAppBar = remember { mutableStateOf(true ) }
102126 val showBottomBar = remember { mutableStateOf(true ) }
@@ -119,11 +143,19 @@ fun UITest(
119143 enter = fadeIn() + expandVertically(),
120144 exit = fadeOut() + shrinkVertically()
121145 ) {
122- BoxWithConstraints {
146+ BoxWithConstraints (
147+ modifier = Modifier
148+ .hazeEffect(hazeState) {
149+ style = hazeStyleTopBar
150+ blurRadius = 25 .dp
151+ noiseFactor = 0f
152+ }
153+ ) {
123154 if (maxWidth > 840 .dp) {
124155 SmallTopAppBar (
125156 title = " Miuix" ,
126157 scrollBehavior = currentScrollBehavior,
158+ color = Color .Transparent ,
127159 actions = {
128160 if (isTopPopupExpanded.value) {
129161 ListPopup (
@@ -174,6 +206,7 @@ fun UITest(
174206 TopAppBar (
175207 title = " Miuix" ,
176208 scrollBehavior = currentScrollBehavior,
209+ color = Color .Transparent ,
177210 actions = {
178211 if (isTopPopupExpanded.value) {
179212 ListPopup (
@@ -262,6 +295,12 @@ fun UITest(
262295 showBottomPopup.value = true
263296 }
264297 NavigationBar (
298+ modifier = Modifier
299+ .hazeEffect(hazeState) {
300+ style = hazeStyleBottomBar
301+ blurRadius = 25 .dp
302+ noiseFactor = 0f
303+ },
265304 items = items,
266305 selected = targetPage,
267306 onClick = { index ->
@@ -294,7 +333,7 @@ fun UITest(
294333 }
295334 ) { padding ->
296335 AppHorizontalPager (
297- modifier = Modifier .imePadding(),
336+ modifier = Modifier .imePadding().hazeSource(state = hazeState) ,
298337 pagerState = pagerState,
299338 topAppBarScrollBehaviorList = topAppBarScrollBehaviorList,
300339 padding = padding,
0 commit comments