@momo-kits/native-kits 0.169.13-beta.1 → 0.169.13-beta.2-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/build.gradle.kts +11 -0
  2. package/compose/build.gradle.kts +198 -0
  3. package/compose/compose.podspec +47 -0
  4. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +61 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +130 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +280 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +304 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +175 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +208 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +291 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +54 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +118 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +206 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +421 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +750 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +242 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +406 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +111 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +446 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +400 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +197 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +117 -0
  124. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +65 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
  132. package/gradle/libs.versions.toml +67 -0
  133. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  134. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  135. package/gradle.properties +24 -0
  136. package/gradlew +252 -0
  137. package/gradlew.bat +94 -0
  138. package/ios/native-kits.podspec +1 -1
  139. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  140. package/ios-demo/README.md +120 -0
  141. package/package.json +1 -1
  142. package/settings.gradle.kts +64 -0
@@ -0,0 +1,750 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.animation.animateColorAsState
4
+ import androidx.compose.animation.core.Animatable
5
+ import androidx.compose.animation.core.AnimationVector1D
6
+ import androidx.compose.animation.core.tween
7
+ import androidx.compose.foundation.ScrollState
8
+ import androidx.compose.foundation.background
9
+ import androidx.compose.foundation.border
10
+ import androidx.compose.foundation.gestures.ScrollableState
11
+ import androidx.compose.foundation.gestures.animateScrollBy
12
+ import androidx.compose.foundation.layout.Box
13
+ import androidx.compose.foundation.layout.Column
14
+ import androidx.compose.foundation.layout.ColumnScope
15
+ import androidx.compose.foundation.layout.Spacer
16
+ import androidx.compose.foundation.layout.WindowInsets
17
+ import androidx.compose.foundation.layout.asPaddingValues
18
+ import androidx.compose.foundation.layout.aspectRatio
19
+ import androidx.compose.foundation.layout.fillMaxSize
20
+ import androidx.compose.foundation.layout.fillMaxWidth
21
+ import androidx.compose.foundation.layout.height
22
+ import androidx.compose.foundation.layout.ime
23
+ import androidx.compose.foundation.layout.imePadding
24
+ import androidx.compose.foundation.layout.offset
25
+ import androidx.compose.foundation.layout.padding
26
+ import androidx.compose.foundation.layout.width
27
+ import androidx.compose.foundation.lazy.LazyListState
28
+ import androidx.compose.foundation.rememberScrollState
29
+ import androidx.compose.foundation.verticalScroll
30
+ import androidx.compose.material.ExperimentalMaterialApi
31
+ import androidx.compose.runtime.Composable
32
+ import androidx.compose.runtime.CompositionLocalProvider
33
+ import androidx.compose.foundation.layout.PaddingValues
34
+ import androidx.compose.runtime.LaunchedEffect
35
+ import androidx.compose.runtime.State
36
+ import androidx.compose.runtime.getValue
37
+ import androidx.compose.runtime.mutableIntStateOf
38
+ import androidx.compose.runtime.mutableStateOf
39
+ import androidx.compose.runtime.remember
40
+ import androidx.compose.runtime.rememberUpdatedState
41
+ import androidx.compose.runtime.snapshotFlow
42
+ import androidx.compose.runtime.staticCompositionLocalOf
43
+ import androidx.compose.ui.Alignment
44
+ import androidx.compose.ui.Modifier
45
+ import androidx.compose.ui.graphics.Brush
46
+ import androidx.compose.ui.graphics.Color
47
+ import androidx.compose.ui.graphics.graphicsLayer
48
+ import androidx.compose.ui.graphics.lerp
49
+ import androidx.compose.ui.layout.onGloballyPositioned
50
+ import androidx.compose.ui.platform.LocalDensity
51
+ import androidx.compose.ui.unit.Dp
52
+ import androidx.compose.ui.unit.dp
53
+ import androidx.compose.ui.unit.lerp
54
+ import androidx.compose.ui.zIndex
55
+ import kotlinx.coroutines.flow.Flow
56
+ import kotlinx.coroutines.flow.filter
57
+ import kotlinx.coroutines.launch
58
+ import vn.momo.kits.components.InputSearch
59
+ import vn.momo.kits.components.InputSearchSize
60
+ import vn.momo.kits.const.AppNavigationBar
61
+ import vn.momo.kits.const.AppTheme
62
+ import vn.momo.kits.application.IsShowBaseLineDebug
63
+ import vn.momo.kits.const.Colors
64
+ import vn.momo.kits.const.Spacing
65
+ import vn.momo.kits.modifier.conditional
66
+ import vn.momo.kits.modifier.hideKeyboardOnTap
67
+ import vn.momo.kits.navigation.component.FABPosition
68
+ import vn.momo.kits.navigation.component.FloatingButton
69
+ import vn.momo.kits.navigation.component.HEADER_HEIGHT
70
+ import vn.momo.kits.navigation.component.Header
71
+ import vn.momo.kits.navigation.component.HeaderBackground
72
+ import vn.momo.kits.navigation.component.HeaderRight
73
+ import vn.momo.kits.navigation.component.HeaderSideBar
74
+ import vn.momo.kits.navigation.bottomtab.LocalDuoRailReserve
75
+ import vn.momo.kits.navigation.bottomtab.LocalTabBarHasCenterAction
76
+ import vn.momo.kits.navigation.bottomtab.duoFloatingTabBarInset
77
+ import vn.momo.kits.navigation.component.HeaderType
78
+ import vn.momo.kits.navigation.component.InputSearchType
79
+ import vn.momo.kits.navigation.bottomtab.LocalBottomTabFocused
80
+ import vn.momo.kits.platform.BackHandler
81
+ import vn.momo.kits.platform.supportsImePadding
82
+ import vn.momo.kits.navigation.tracking.ScreenTracker
83
+ import vn.momo.kits.navigation.tracking.ScreenTrackingState
84
+ import kotlinx.coroutines.delay
85
+ import vn.momo.kits.application.LocalContext
86
+ import vn.momo.kits.utils.horizontalSafeAreaPadding
87
+ import vn.momo.kits.layout.LocalScreenLayout
88
+ import vn.momo.kits.layout.ScreenLayout
89
+ import vn.momo.kits.layout.consumeHorizontalInsets
90
+ import vn.momo.kits.layout.HEADER_BANNER_WIDTH
91
+ import vn.momo.kits.layout.HEADER_BUTTON_SIZE
92
+ import vn.momo.kits.layout.HEADER_TITLE_GAP
93
+ import vn.momo.kits.layout.getScreenLayout
94
+ import vn.momo.kits.layout.rememberHeaderLayout
95
+ import kotlin.time.Clock
96
+ import kotlin.time.Duration.Companion.milliseconds
97
+ import kotlin.time.ExperimentalTime
98
+
99
+ @Composable
100
+ fun floatingTabBarContentPadding(): PaddingValues {
101
+ val navigation = LocalNavigation.current
102
+ LaunchedEffect(navigation) { navigation.bottomTabEdgeToEdge = true }
103
+ val reserve = navigation.bottomTabIndex != -1 && navigation.bottomTabEdgeToEdge
104
+ return PaddingValues(bottom = if (reserve) bottomTabChildInset() else 0.dp)
105
+ }
106
+
107
+ internal val LocalFooterHeightPx = staticCompositionLocalOf { mutableIntStateOf(0) }
108
+ internal val LocalHeaderRightWidthPx = staticCompositionLocalOf { mutableIntStateOf(0) }
109
+
110
+ // Space a tab's content leaves for the tab bar and home indicator: the horizontal bar floats over the
111
+ // content (phone and unfolded Duo); the Duo rail lives in the side strip, so only the home indicator.
112
+ @Composable
113
+ private fun bottomTabChildInset(): Dp {
114
+ val keyboard = keyboardSizeState().value
115
+ val navigationBar = AppNavigationBar.current
116
+ val layout = getScreenLayout()
117
+ return when {
118
+ layout.isIPhoneDuo && layout.sideBar != null -> (navigationBar - keyboard).coerceAtLeast(0.dp)
119
+ else -> (duoFloatingTabBarInset(layout, LocalTabBarHasCenterAction.current) - keyboard).coerceAtLeast(0.dp)
120
+ }
121
+ }
122
+
123
+ @OptIn(ExperimentalMaterialApi::class, ExperimentalTime::class)
124
+ @Composable
125
+ internal fun StackScreen(
126
+ content: @Composable () -> Unit,
127
+ navigationOptions: NavigationOptions? = null,
128
+ id: Int = -1,
129
+ name: String = "",
130
+ bottomTabIndex: Int = -1,
131
+ onBackHandler: (() -> Unit)? = null,
132
+ ) {
133
+ val navigator = LocalNavigator.current
134
+ val maxApi = LocalMaxApi.current
135
+ val context = LocalContext.current
136
+ val screenLayout = getScreenLayout()
137
+ val density = LocalDensity.current
138
+ val screenRegistry = LocalDynamicScreenRegistry.current
139
+ val navigation = remember { Navigation(id = id, bottomTabIndex = bottomTabIndex, initOptions = navigationOptions, registry = screenRegistry) }
140
+
141
+ val options by navigation.currentOptions
142
+ val isBottomTabChild = bottomTabIndex != -1
143
+ val isBottomTabRoot = navigation.isBottomTabRoot
144
+
145
+ // A mounted-but-hidden bottom tab tracks again each time it is focused (RN useFocusEffect).
146
+ val tabFocused = LocalBottomTabFocused.current
147
+
148
+ val trackingState = remember(tabFocused) {
149
+ ScreenTrackingState().apply {
150
+ time = Clock.System.now().toEpochMilliseconds()
151
+ }
152
+ }
153
+
154
+ val action = remember(tabFocused) {
155
+ if (ScreenTracker.getLastScreenName() != null) "push" else "back"
156
+ }
157
+
158
+ LaunchedEffect(name, tabFocused) {
159
+ if (!tabFocused) return@LaunchedEffect
160
+ ScreenTracker.trackScreenNavigated(
161
+ maxApi = maxApi,
162
+ context = context,
163
+ screenName = name,
164
+ action = action,
165
+ state = trackingState
166
+ )
167
+
168
+ delay(2000.milliseconds)
169
+ val loadTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
170
+ ScreenTracker.trackScreenDisplayed(
171
+ maxApi = maxApi,
172
+ context = context,
173
+ screenName = name,
174
+ duration = loadTime,
175
+ state = trackingState
176
+ )
177
+
178
+ val interactionTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
179
+ ScreenTracker.trackScreenInteracted(
180
+ maxApi = maxApi,
181
+ context = context,
182
+ screenName = name,
183
+ duration = interactionTime - loadTime,
184
+ totalDuration = interactionTime,
185
+ state = trackingState
186
+ )
187
+ }
188
+
189
+ val limit = with(density) {
190
+ screenLayout.headerHeight.toPx()
191
+ }.toInt()
192
+
193
+ val lazyListState = options.scrollData.scrollState as? LazyListState
194
+ val (scrollState, _) = if (lazyListState != null)
195
+ lazyListState.proxyScrollState(limit, 1)
196
+ else
197
+ (options.scrollData.scrollState as? ScrollState ?: rememberScrollState()).proxyLimitedScrollState(limit, 1)
198
+ val snapState: ScrollableState = lazyListState ?: scrollState
199
+ val headerHide = rememberQuickReturnHide(
200
+ enabled = options.usesDuoQuickReturnHeader(screenLayout),
201
+ scrollState = scrollState,
202
+ heightPx = with(density) { screenLayout.headerHeight.toPx() },
203
+ )
204
+
205
+ val footerHeightPx = remember { mutableIntStateOf(0) }
206
+ val headerRightWidthPx = remember { mutableIntStateOf(0) }
207
+
208
+ if (tabFocused && navigation.options.scrollData.scrollToTopCallback != null) {
209
+ RegisterScrollToTop(navigation.options.scrollData.scrollToTopCallback)
210
+ }
211
+
212
+ val canPop = navigator.canPop()
213
+
214
+ val hasCustomBackHandling = !SwipeBackConfig.enabled || OverplayComponentRegistry.isOverplayShowing() || !canPop
215
+
216
+ BackHandler(hasCustomBackHandling) { navigator.onBackSafe() }
217
+
218
+ CompositionLocalProvider(
219
+ StackScreenScrollableState provides options.scrollData.scrollState,
220
+ LocalNavigation provides navigation,
221
+ LocalScrollState provides scrollState,
222
+ LocalOptions provides options,
223
+ LocalFooterHeightPx provides footerHeightPx,
224
+ LocalHeaderRightWidthPx provides headerRightWidthPx
225
+ ) {
226
+ Box(Modifier.fillMaxSize()) {
227
+ options.backgroundComponent?.let { background ->
228
+ Box(Modifier.fillMaxSize()) { background() }
229
+ }
230
+ Box(
231
+ Modifier
232
+ .fillMaxSize()
233
+ .background(
234
+ if (options.backgroundComponent != null) Color.Transparent
235
+ else options.backgroundColor ?: AppTheme.current.colors.background.default
236
+ )
237
+ .conditional(options.keyboardOptions.keyboardShouldPersistTaps) {
238
+ hideKeyboardOnTap()
239
+ }
240
+ .conditional(options.keyboardOptions.useAvoidKeyboard && supportsImePadding()) {
241
+ imePadding()
242
+ }
243
+ ) {
244
+ Box(Modifier.zIndex(1f)) {
245
+ HeaderBackground()
246
+ }
247
+
248
+ Box(Modifier.zIndex(4f).graphicsLayer { translationY = -headerHide.value }) {
249
+ Header(onBackHandler)
250
+ }
251
+
252
+ HeaderSideBar(
253
+ bottomInset = maxOf(
254
+ bottomBarsHeight(isBottomTabChild) + Spacing.XL,
255
+ if (isBottomTabChild) LocalDuoRailReserve.current else 0.dp,
256
+ ),
257
+ modifier = Modifier.zIndex(4f),
258
+ )
259
+
260
+ Column(Modifier.zIndex(5f).horizontalSafeAreaPadding()) {
261
+ SearchAnimated(snapState = snapState)
262
+ }
263
+
264
+ Column(Modifier.zIndex(2f).fillMaxSize()) {
265
+ MainContent(content = content, isBottomTabRoot = isBottomTabRoot, isBottomTabChild = isBottomTabChild)
266
+ FooterContent()
267
+ }
268
+
269
+ Box(Modifier.zIndex(6f).horizontalSafeAreaPadding()) {
270
+ FloatingContent(isBottomTabChild = isBottomTabChild)
271
+ }
272
+
273
+ OverplayView(isBottomTabChild = isBottomTabChild, id = id)
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ // Height the footer, tab bar or home indicator takes from the bottom of the screen.
280
+ @Composable
281
+ private fun bottomBarsHeight(isBottomTabChild: Boolean): Dp {
282
+ val options = LocalOptions.current
283
+ val navigationBar = AppNavigationBar.current
284
+ return when {
285
+ options.hasFooter() -> with(LocalDensity.current) { LocalFooterHeightPx.current.intValue.toDp() }
286
+ isBottomTabChild -> bottomTabChildInset()
287
+ else -> navigationBar
288
+ }
289
+ }
290
+
291
+ @Suppress("FrequentlyChangingValue")
292
+ @Composable
293
+ internal fun FloatingContent(isBottomTabChild: Boolean) {
294
+ val options = LocalOptions.current
295
+ val scrollState = LocalScrollState.current
296
+
297
+ val fabProps = options.floatingButtonProps ?: return
298
+ val bottomPadding = fabProps.bottom ?: (Spacing.M + bottomBarsHeight(isBottomTabChild))
299
+
300
+ FloatingButton(
301
+ scrollPosition = fabProps.scrollState?.value ?: scrollState.value,
302
+ onClick = fabProps.onClick,
303
+ containerColor = AppTheme.current.colors.primary,
304
+ bottom = bottomPadding,
305
+ icon = fabProps.icon,
306
+ iconColor = fabProps.iconColor,
307
+ text = fabProps.label,
308
+ size = fabProps.size,
309
+ position = fabProps.position ?: FABPosition.END,
310
+ )
311
+ }
312
+
313
+ @Composable
314
+ internal fun ColumnScope.MainContent(content: @Composable () -> Unit, isBottomTabRoot: Boolean, isBottomTabChild: Boolean) {
315
+ val options = LocalOptions.current
316
+ val inputSearchType = getInputSearchType(options)
317
+ val density = LocalDensity.current
318
+ val scrollState = LocalScrollState.current
319
+ val navigationBar = AppNavigationBar.current
320
+ val screenLayout = getScreenLayout()
321
+ val useDuoGlass = options.usesDuoGlassHeader(screenLayout)
322
+
323
+ Spacer(
324
+ Modifier.height(
325
+ if (!useDuoGlass && (options.headerType is HeaderType.DefaultOrExtended || (options.headerType is HeaderType.Transparent && !options.headerType.isFullScreenContent)))
326
+ screenLayout.headerHeight else 0.dp
327
+ )
328
+ )
329
+ if (inputSearchType == InputSearchType.Animated) {
330
+ val scrollDp = with(density) { scrollState.value.toDp() }
331
+
332
+ Spacer(Modifier.height((HEADER_HEIGHT.dp - scrollDp).coerceIn(0.dp, HEADER_HEIGHT.dp)))
333
+ }
334
+ val insetContent = !isBottomTabRoot
335
+ Column(
336
+ Modifier
337
+ .fillMaxWidth()
338
+ .weight(1f)
339
+ .conditional(insetContent && options.headerType !is HeaderType.Animated) {
340
+ horizontalSafeAreaPadding()
341
+ }
342
+ .conditional(options.scrollData.scrollable && options.scrollData.scrollState is ScrollState) {
343
+ verticalScroll(scrollState)
344
+ }
345
+ .conditional(useDuoGlass) {
346
+ padding(top = screenLayout.headerHeight)
347
+ }
348
+ .padding(
349
+ bottom = when {
350
+ options.hasFooter() || isBottomTabRoot -> 0.dp
351
+ // 0 when the tab pads itself via floatingTabBarContentPadding(), else the kit reserves the bar space
352
+ isBottomTabChild -> if (LocalNavigation.current.bottomTabEdgeToEdge) 0.dp else bottomTabChildInset()
353
+ !options.scrollData.scrollable && options.scrollData.scrollState == null -> 0.dp
354
+ else -> navigationBar
355
+ }
356
+ )
357
+ ) {
358
+ ScreenContent(content = content, insetContent = insetContent)
359
+ }
360
+
361
+ }
362
+
363
+ @Composable
364
+ internal fun ScreenContent(content: @Composable () -> Unit, insetContent: Boolean) {
365
+ val scrollState = LocalScrollState.current
366
+ val options = LocalOptions.current
367
+ val screenLayout = getScreenLayout()
368
+ val insetBody: @Composable () -> Unit = {
369
+ CompositionLocalProvider(
370
+ LocalScreenLayout provides if (insetContent) screenLayout.consumeHorizontalInsets() else screenLayout,
371
+ content = content,
372
+ )
373
+ }
374
+
375
+ if (options.headerType is HeaderType.Animated) {
376
+ val animatedHeader = options.headerType
377
+ val isBannerCentered = rememberHeaderLayout(options.contentLayout).isBannerCentered
378
+ Box {
379
+ // wide windows and the iPhone Duo inner display keep the phone banner size, centered over
380
+ // a fill fading down from bannerBackgroundColor
381
+ val bannerWidth = if (isBannerCentered) Modifier.width(HEADER_BANNER_WIDTH) else Modifier.fillMaxWidth()
382
+ val bannerModifier = animatedHeader.height
383
+ ?.let { bannerWidth.height(it) }
384
+ ?: bannerWidth.aspectRatio(animatedHeader.aspectRatio.value)
385
+ Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.TopCenter) {
386
+ val fill = animatedHeader.bannerBackgroundColor
387
+ if (isBannerCentered && fill != null) {
388
+ Box(
389
+ Modifier.matchParentSize()
390
+ .background(Brush.verticalGradient(listOf(fill, fill.copy(alpha = 0f))))
391
+ )
392
+ }
393
+ Box(bannerModifier) {
394
+ animatedHeader.composable.invoke(scrollState.value)
395
+ }
396
+ }
397
+ Box(
398
+ Modifier
399
+ .padding(top = screenLayout.headerHeight + animatedHeader.layoutOffSet)
400
+ .conditional(insetContent) { horizontalSafeAreaPadding() }
401
+ ) {
402
+ insetBody()
403
+ }
404
+ }
405
+ } else {
406
+ insetBody()
407
+ }
408
+ }
409
+
410
+ @Composable
411
+ internal fun FooterContent() {
412
+ val options = LocalOptions.current
413
+ if (options.hasFooter()) {
414
+ val keyboardSize = keyboardSizeState()
415
+ // the floating tab bar overlays tab content, so a tab's footer sits above it
416
+ val duoTabInset = if (LocalNavigation.current.bottomTabIndex != -1) duoFloatingTabBarInset(getScreenLayout(), LocalTabBarHasCenterAction.current) else 0.dp
417
+ val bottomPadding = (maxOf(AppNavigationBar.current, duoTabInset) - keyboardSize.value).coerceAtLeast(0.dp)
418
+ Footer(
419
+ footerComponent = options.footerComponent,
420
+ bottomPadding = bottomPadding,
421
+ transparent = options.footerTransparent,
422
+ useMargin = options.footerUseMargin
423
+ )
424
+ }
425
+ }
426
+
427
+ @Composable
428
+ internal fun keyboardSizeState(): State<Dp> {
429
+ val bottom = WindowInsets.ime.asPaddingValues()
430
+ return rememberUpdatedState(bottom.calculateBottomPadding())
431
+ }
432
+
433
+ @Composable
434
+ internal fun OverplayView(isBottomTabChild: Boolean, id: Int) {
435
+ val overplayType = OverplayComponentRegistry.getOverplayType()
436
+
437
+ if (overplayType != null) {
438
+ Box(Modifier.zIndex(if (overplayType == OverplayComponentType.SNACK_BAR) 3f else 7f).fillMaxSize()) {
439
+ if (isBottomTabChild) return@Box
440
+ if (OverplayComponentRegistry.currentRootId() != id) return@Box
441
+ OverplayComponentRegistry.OverlayComponent()
442
+ }
443
+ }
444
+ }
445
+
446
+ @Composable
447
+ fun Footer(
448
+ footerComponent: @Composable (() -> Unit)?,
449
+ bottomPadding: Dp,
450
+ transparent: Boolean = false,
451
+ useMargin: Boolean = true,
452
+ ) {
453
+ if (footerComponent == null) return
454
+
455
+ val footerHeightPx = LocalFooterHeightPx.current
456
+
457
+ val shadowBrush = remember {
458
+ Brush.verticalGradient(
459
+ colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
460
+ )
461
+ }
462
+
463
+ val backgroundColor = if (transparent) Color.Transparent else AppTheme.current.colors.background.surface
464
+
465
+ // inset as a whole, not padded inside, so the surface and its shadow stay off the iPhone Duo side bar
466
+ Box(Modifier.onGloballyPositioned {
467
+ if (footerHeightPx.intValue != it.size.height) footerHeightPx.intValue = it.size.height
468
+ }.horizontalSafeAreaPadding()) {
469
+ Box(
470
+ Modifier
471
+ .fillMaxWidth()
472
+ .background(backgroundColor)
473
+ .conditional(IsShowBaseLineDebug) {
474
+ border(1.dp, Colors.blue_03)
475
+ }
476
+ .padding(
477
+ top = if (useMargin) Spacing.S else 0.dp,
478
+ start = if (useMargin) Spacing.M else 0.dp,
479
+ end = if (useMargin) Spacing.M else 0.dp,
480
+ bottom = bottomPadding + if (useMargin) Spacing.S else 0.dp,
481
+ )
482
+ ) {
483
+ footerComponent.invoke()
484
+ }
485
+
486
+ if (!transparent) {
487
+ Box(
488
+ modifier = Modifier
489
+ .fillMaxWidth()
490
+ .height(6.dp)
491
+ .offset(x = 0.dp, y = (-6).dp)
492
+ .background(shadowBrush)
493
+ )
494
+ }
495
+ }
496
+ }
497
+
498
+ data class InputSearchLayoutParams(
499
+ val topPadding: Dp,
500
+ val startPadding: Dp,
501
+ val endPadding: Dp
502
+ )
503
+
504
+ @Suppress("FrequentlyChangingValue")
505
+ @Composable
506
+ internal fun SearchAnimated(
507
+ snapState: ScrollableState
508
+ ) {
509
+ val scrollState = LocalScrollState.current
510
+ val options = LocalOptions.current
511
+ val navigator = LocalNavigator.current
512
+ val density = LocalDensity.current
513
+
514
+ val scrollDp = with(density) { scrollState.value.toDp() }
515
+
516
+ val inputSearchType = getInputSearchType(options)
517
+ val headerRightWidthPx = LocalHeaderRightWidthPx.current
518
+ val headerRightWidthDp = with(density) { headerRightWidthPx.intValue.toDp() }
519
+
520
+ if (inputSearchType == InputSearchType.None) return
521
+ val inputSearchProps = (options.headerType as? HeaderType.DefaultOrExtended)?.inputSearchProps ?: return
522
+
523
+ val screenLayout = getScreenLayout()
524
+ val useSideBar = screenLayout.sideBar != null
525
+ // collapsed, the search is centered in the bar row
526
+ val minTopPadding = screenLayout.headerStatusBarHeight + (screenLayout.headerBarHeight - HEADER_HEIGHT.dp) / 2
527
+ val maxTopPadding = screenLayout.headerHeight
528
+ // collapsed on the iPhone Duo status bar row, the search stays between its clusters
529
+ val clearance = screenLayout.statusBarClearance
530
+ // stretch screens on wide windows keep the search in the header's centered frame
531
+ val sidePadding = rememberHeaderLayout(options.contentLayout).frameInset
532
+ val minStartPadding = sidePadding
533
+ val maxStartPadding = (clearance?.left ?: 0.dp) +
534
+ if (options.hiddenBack || useSideBar) sidePadding else HEADER_BUTTON_SIZE + sidePadding + HEADER_TITLE_GAP
535
+ val minEndPadding = sidePadding
536
+ val maxEndPadding = (clearance?.right ?: 0.dp) + when {
537
+ options.headerRight is HeaderRight.None -> sidePadding
538
+ useSideBar && options.headerRight is HeaderRight.Toolkit -> sidePadding
539
+ else -> headerRightWidthDp + sidePadding + Spacing.M
540
+ }
541
+
542
+ val targetColor = lerp(
543
+ AppTheme.current.colors.background.surface,
544
+ AppTheme.current.colors.background.default,
545
+ (scrollDp / minTopPadding.coerceAtLeast(1.dp)).coerceIn(0f, 1f)
546
+ )
547
+ val animatedColor by animateColorAsState(targetValue = targetColor, label = "BackgroundColor")
548
+
549
+ val layoutParams = when (inputSearchType) {
550
+ InputSearchType.Header -> {
551
+ InputSearchLayoutParams(
552
+ topPadding = minTopPadding,
553
+ startPadding = maxStartPadding,
554
+ endPadding = maxEndPadding
555
+ )
556
+ }
557
+
558
+ InputSearchType.Animated -> {
559
+ val collapsePx = with(density) { HEADER_HEIGHT.dp.roundToPx() }
560
+ val progress = (scrollState.value / collapsePx.toFloat()).coerceIn(0f, 1f)
561
+
562
+ LaunchedEffect(snapState, collapsePx) {
563
+ snapshotFlow { snapState.isScrollInProgress }
564
+ .filter { !it }
565
+ .collect {
566
+ val offset = snapState.headerOffsetPx() ?: return@collect
567
+ if (offset <= 0 || offset >= collapsePx) return@collect
568
+ val target = if (offset < collapsePx / 2) 0 else collapsePx
569
+ launch { snapState.animateScrollBy((target - offset).toFloat()) }
570
+ }
571
+ }
572
+
573
+ InputSearchLayoutParams(
574
+ topPadding = lerp(maxTopPadding, minTopPadding, progress),
575
+ startPadding = lerp(minStartPadding, maxStartPadding, progress),
576
+ endPadding = lerp(minEndPadding, maxEndPadding, progress)
577
+ )
578
+ }
579
+
580
+ InputSearchType.None -> return
581
+ }
582
+
583
+ Spacer(Modifier.height(layoutParams.topPadding))
584
+ Box(
585
+ modifier = Modifier
586
+ .height(HEADER_HEIGHT.dp)
587
+ .fillMaxWidth()
588
+ .padding(
589
+ start = layoutParams.startPadding,
590
+ end = layoutParams.endPadding
591
+ ),
592
+ contentAlignment = Alignment.Center
593
+ ) {
594
+ InputSearch(
595
+ inputSearchProps = inputSearchProps.copy(
596
+ backgroundColor = animatedColor,
597
+ onPressButtonText = {
598
+ navigator.pop()
599
+ }
600
+ ),
601
+ size = InputSearchSize.Header,
602
+ )
603
+ }
604
+ }
605
+
606
+ private fun ScrollableState.headerOffsetPx(): Int? = when (this) {
607
+ is LazyListState -> if (firstVisibleItemIndex == 0) firstVisibleItemScrollOffset else null
608
+ is ScrollState -> value
609
+ else -> null
610
+ }
611
+
612
+ private fun quantize(value: Int, stepPx: Int): Int {
613
+ if (stepPx <= 1) return value
614
+ return (value / stepPx) * stepPx
615
+ }
616
+
617
+ @Composable
618
+ internal fun LazyListState.proxyScrollState(
619
+ thresholdPx: Int = 200,
620
+ stepPx: Int = 4
621
+ ): Pair<ScrollState, Boolean> = proxyScroll(
622
+ source = this,
623
+ thresholdPx = thresholdPx,
624
+ stepPx = stepPx,
625
+ isScrollInProgress = { isScrollInProgress },
626
+ rawTargetFlow = {
627
+ snapshotFlow {
628
+ if (firstVisibleItemIndex == 0) firstVisibleItemScrollOffset
629
+ else SCROLLED_PAST_FIRST_ITEM_THRESHOLD
630
+ }
631
+ },
632
+ )
633
+
634
+ @Composable
635
+ internal fun ScrollState.proxyLimitedScrollState(
636
+ thresholdPx: Int = 200,
637
+ stepPx: Int = 4
638
+ ): Pair<ScrollState, Boolean> = proxyScroll(
639
+ source = this,
640
+ thresholdPx = thresholdPx,
641
+ stepPx = stepPx,
642
+ isScrollInProgress = { isScrollInProgress },
643
+ rawTargetFlow = { snapshotFlow { value } },
644
+ )
645
+
646
+ @Composable
647
+ private fun proxyScroll(
648
+ source: Any,
649
+ thresholdPx: Int,
650
+ stepPx: Int,
651
+ isScrollInProgress: () -> Boolean,
652
+ rawTargetFlow: () -> Flow<Int>,
653
+ ): Pair<ScrollState, Boolean> {
654
+ val proxy = rememberScrollState()
655
+ val locked = remember { mutableStateOf(false) }
656
+
657
+ LaunchedEffect(source, proxy, thresholdPx, stepPx) {
658
+ rawTargetFlow().collect { rawTarget ->
659
+ val shouldLock = rawTarget > thresholdPx
660
+ if (locked.value != shouldLock) locked.value = shouldLock
661
+
662
+ val desired = if (shouldLock) thresholdPx else quantize(rawTarget, stepPx)
663
+
664
+ if (proxy.value != desired) {
665
+ proxy.scrollTo(desired.coerceAtLeast(0))
666
+ }
667
+ }
668
+ }
669
+
670
+ val inProgress = remember { mutableStateOf(false) }
671
+ LaunchedEffect(source, thresholdPx) {
672
+ snapshotFlow { isScrollInProgress() }
673
+ .collect { progressing ->
674
+ inProgress.value = if (locked.value) false else progressing
675
+ }
676
+ }
677
+
678
+ return proxy to inProgress.value
679
+ }
680
+
681
+ private const val SCROLLED_PAST_FIRST_ITEM_THRESHOLD = 10_000
682
+
683
+ internal val LocalScrollState = staticCompositionLocalOf<ScrollState> { error("No Scroll State provided") }
684
+ internal val LocalOptions = staticCompositionLocalOf<NavigationOptions> { error("No NavigationOptions provided") }
685
+
686
+ val StackScreenScrollableState = staticCompositionLocalOf<ScrollableState?> { null }
687
+
688
+ // iPhone Duo side bar: the header leaves with the content and slides back in on a reverse scroll
689
+ // (RN DuoQuickReturnHeader). The side bar is drawn apart from the header, so it stays put.
690
+ @Composable
691
+ private fun rememberQuickReturnHide(
692
+ enabled: Boolean,
693
+ scrollState: ScrollState,
694
+ heightPx: Float,
695
+ ): Animatable<Float, AnimationVector1D> {
696
+ val hide = remember { Animatable(0f) }
697
+ LaunchedEffect(enabled, scrollState, heightPx) {
698
+ if (!enabled) {
699
+ hide.snapTo(0f)
700
+ return@LaunchedEffect
701
+ }
702
+ var last = scrollState.value
703
+ snapshotFlow { scrollState.value }.collect { y ->
704
+ val delta = y - last
705
+ last = y
706
+ hide.snapTo(if (y <= 0) 0f else (hide.value + delta).coerceIn(0f, heightPx))
707
+ }
708
+ }
709
+ // a half-shown header settles fully in or out once the scroll stops
710
+ LaunchedEffect(enabled, scrollState, heightPx) {
711
+ if (!enabled) return@LaunchedEffect
712
+ snapshotFlow { scrollState.isScrollInProgress }
713
+ .filter { !it }
714
+ .collect {
715
+ val value = hide.value
716
+ // within the first header height the header still sits on the content
717
+ if (scrollState.value < heightPx || value <= 0f || value >= heightPx) return@collect
718
+ launch { hide.animateTo(if (value > heightPx / 2) heightPx else 0f, tween(200)) }
719
+ }
720
+ }
721
+ return hide
722
+ }
723
+
724
+ internal fun NavigationOptions.usesDuoQuickReturnHeader(layout: ScreenLayout): Boolean {
725
+ if (usesDuoGlassHeader(layout)) return true
726
+ return layout.sideBar != null && headerType is HeaderType.Animated && scrollsWithScrollState()
727
+ }
728
+
729
+ // iPhone Duo side bar: content scrolls under a glass header instead of starting below it (RN Screen).
730
+ internal fun NavigationOptions.usesDuoGlassHeader(layout: ScreenLayout): Boolean {
731
+ if (layout.sideBar == null || headerType !is HeaderType.DefaultOrExtended) return false
732
+ return getInputSearchType(this) == InputSearchType.None && scrollsWithScrollState()
733
+ }
734
+
735
+ private fun NavigationOptions.scrollsWithScrollState(): Boolean {
736
+ return scrollData.scrollable && scrollData.scrollState is ScrollState
737
+ }
738
+
739
+ internal fun getInputSearchType(options: NavigationOptions): InputSearchType {
740
+ return when (val headerType = options.headerType) {
741
+ is HeaderType.DefaultOrExtended -> when {
742
+ headerType.inputSearchProps == null -> InputSearchType.None
743
+ headerType.useAnimated -> InputSearchType.Animated
744
+ else -> InputSearchType.Header
745
+ }
746
+
747
+ else -> InputSearchType.None
748
+ }
749
+ }
750
+