@momo-kits/native-kits 0.163.1-beta.1 → 0.163.1-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 (155) hide show
  1. package/build.gradle.kts +11 -0
  2. package/compose/build.gradle.kts +189 -0
  3. package/compose/build.gradle.kts.backup +189 -0
  4. package/compose/compose.podspec +47 -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/Platform.android.kt +123 -0
  7. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  8. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  9. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  10. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +108 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +107 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +140 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +180 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +134 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +269 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +94 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +175 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +557 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +155 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +223 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +319 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +70 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +58 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -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/Platform.ios.kt +184 -0
  128. package/gradle/libs.versions.toml +67 -0
  129. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  130. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  131. package/gradle.properties +26 -0
  132. package/gradlew +252 -0
  133. package/gradlew.bat +94 -0
  134. package/ios/Application/ApplicationEnvironment.swift +1 -0
  135. package/ios/Application/Components.swift +1 -0
  136. package/ios/Application/FloatingButton.swift +1 -0
  137. package/ios/Application/FontScaleStore.swift +59 -0
  138. package/ios/Badge/Badge.swift +1 -0
  139. package/ios/Badge/BadgeRibbon.swift +2 -0
  140. package/ios/Button/Button.swift +1 -1
  141. package/ios/Checkbox/Checkbox.swift +1 -0
  142. package/ios/Information/Information.swift +151 -0
  143. package/ios/Input/Input.swift +1 -0
  144. package/ios/Input/InputPhoneNumber.swift +1 -0
  145. package/ios/Input/InputSearch.swift +3 -0
  146. package/ios/Input/InputTextArea.swift +1 -0
  147. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  148. package/ios/Popup/PopupDisplay.swift +6 -0
  149. package/ios/Popup/PopupInput.swift +2 -0
  150. package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
  151. package/ios/Typography/Text.swift +13 -7
  152. package/ios/Typography/Typography.swift +22 -8
  153. package/local.properties +8 -0
  154. package/package.json +1 -1
  155. package/settings.gradle.kts +64 -0
@@ -0,0 +1,826 @@
1
+ package vn.momo.kits.application
2
+
3
+ import androidx.annotation.FloatRange
4
+ import androidx.compose.animation.animateContentSize
5
+ import androidx.compose.foundation.*
6
+ import androidx.compose.foundation.gestures.detectTapGestures
7
+ import androidx.compose.foundation.interaction.FocusInteraction
8
+ import androidx.compose.foundation.interaction.MutableInteractionSource
9
+ import androidx.compose.foundation.layout.*
10
+ import androidx.compose.foundation.shape.CircleShape
11
+ import androidx.compose.foundation.text.BasicTextField
12
+ import androidx.compose.foundation.text.KeyboardActions
13
+ import androidx.compose.foundation.text.KeyboardOptions
14
+ import androidx.compose.runtime.*
15
+ import androidx.compose.ui.Alignment
16
+ import androidx.compose.ui.Modifier
17
+ import androidx.compose.ui.composed
18
+ import androidx.compose.ui.draw.clip
19
+ import androidx.compose.ui.draw.drawBehind
20
+ import androidx.compose.ui.draw.drawWithContent
21
+ import androidx.compose.ui.geometry.Offset
22
+ import androidx.compose.ui.geometry.Rect
23
+ import androidx.compose.ui.graphics.Brush
24
+ import androidx.compose.ui.graphics.Color
25
+ import androidx.compose.ui.graphics.SolidColor
26
+ import androidx.compose.ui.graphics.graphicsLayer
27
+ import androidx.compose.ui.input.pointer.pointerInput
28
+ import androidx.compose.ui.layout.*
29
+ import androidx.compose.ui.platform.LocalDensity
30
+ import androidx.compose.ui.platform.LocalFocusManager
31
+ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
32
+ import androidx.compose.ui.text.TextStyle
33
+ import androidx.compose.ui.text.style.TextOverflow
34
+ import androidx.compose.ui.unit.*
35
+ import kotlinx.coroutines.flow.collectLatest
36
+ import kotlinx.coroutines.flow.mapNotNull
37
+ import vn.momo.kits.components.Icon
38
+ import vn.momo.kits.components.Text
39
+ import vn.momo.kits.const.AppTheme
40
+ import vn.momo.kits.const.Colors
41
+ import vn.momo.kits.const.Spacing
42
+ import vn.momo.kits.const.Typography
43
+ import vn.momo.kits.modifier.kitsAutomationId
44
+ import vn.momo.kits.modifier.noFeedbackClickable
45
+ import vn.momo.kits.modifier.setAutomationId
46
+ import vn.momo.kits.navigation.component.HEADER_HEIGHT
47
+ import vn.momo.kits.utils.getAppStatusBarHeight
48
+ import kotlin.math.max
49
+ import kotlin.math.roundToInt
50
+
51
+
52
+ data class AnimationOption(
53
+ val targetBounds: Rect,
54
+ val progress: State<Float>,
55
+ @param:FloatRange(from = 0.0, to = 1.0)
56
+ val opacityLimitFraction: Float = 0f,
57
+ ) {
58
+ val opacityCap: Float
59
+ get() = 1f - opacityLimitFraction
60
+
61
+ val animateOpacity: Float
62
+ get() {
63
+ if (progress.value < opacityLimitFraction) return 0f
64
+ return androidx.compose.ui.util.lerp(
65
+ 0f,
66
+ 1f,
67
+ (progress.value - opacityLimitFraction) / (opacityCap),
68
+ )
69
+ }
70
+ }
71
+
72
+ val LocalAnimationOption = staticCompositionLocalOf<AnimationOption?> { null }
73
+
74
+ @Composable
75
+ fun LiteScreen(
76
+ scrollable: Boolean = true,
77
+ scrollState: ScrollState? = null,
78
+ headerType: HeaderType = HeaderType.DEFAULT,
79
+ verticalArrangement: Arrangement.Vertical = Arrangement.Top,
80
+ horizontalAlignment: Alignment.Horizontal = Alignment.Start,
81
+ backgroundColor: Color = AppTheme.current.colors.background.default,
82
+ /* Begin of header props */
83
+ title: String? = null,
84
+ inputSearchProps: LiteInputSearchProps? = null,
85
+ goBack: (() -> Unit)? = null,
86
+ headerRight: @Composable (() -> Unit)? = null,
87
+ useAnimationSearch: Boolean = true,
88
+ titlePosition: TitlePosition = TitlePosition.LEFT,
89
+ headerRightData: HeaderRightData? = null,
90
+ headerTintColor: Color? = null,
91
+ headerBackgroundColor: Color? = null,
92
+ headerSpaceBetween: Dp? = null,
93
+ /* End of header props */
94
+
95
+ screenContent: @Composable () -> Unit,
96
+ ) {
97
+ val content by rememberUpdatedState(screenContent)
98
+
99
+ val finalScrollState = scrollState ?: rememberScrollState()
100
+
101
+ val contentModifier = remember(
102
+ key1 = scrollable,
103
+ key2 = finalScrollState,
104
+ ) {
105
+ var res: Modifier = Modifier
106
+ .background(color = backgroundColor)
107
+ if (scrollable) {
108
+ res = res.verticalScroll(finalScrollState)
109
+ }
110
+ res
111
+ }
112
+
113
+ LiteScreenLayout(
114
+ scrollState = finalScrollState,
115
+ modifier = Modifier
116
+ .fillMaxSize()
117
+ .hideKeyboardOnTap(),
118
+ contentModifier = contentModifier,
119
+ verticalArrangement = verticalArrangement,
120
+ horizontalAlignment = horizontalAlignment,
121
+ title = title,
122
+ headerRight = headerRight,
123
+ headerType = headerType,
124
+ onGoBack = goBack,
125
+ inputSearchProps = inputSearchProps,
126
+ titlePosition = titlePosition,
127
+ useAnimationSearch = useAnimationSearch,
128
+ headerRightData = headerRightData,
129
+ tintColor = headerTintColor,
130
+ headerBackgroundColor = headerBackgroundColor,
131
+ headerSpaceBetween = headerSpaceBetween,
132
+ ) {
133
+ content()
134
+ }
135
+ }
136
+
137
+ private object HeaderId {
138
+ private const val PACKAGE_NAME = "vn.momo.compose.kits"
139
+ const val CONTENT_ID = "${PACKAGE_NAME}.content"
140
+ const val BACKGROUND_ID = "${PACKAGE_NAME}.background"
141
+ const val BACK_ID = "${PACKAGE_NAME}.back"
142
+ const val HEADER_RIGHT_ID = "${PACKAGE_NAME}.headerRight"
143
+ const val INPUT_SEARCH_ID = "${PACKAGE_NAME}.inputSearch"
144
+ const val TITLE_ID = "${PACKAGE_NAME}.title"
145
+
146
+ val EXTENDED_HEADER_HEIGHT = 154.dp
147
+ }
148
+
149
+ @Composable
150
+ private fun LiteScreenLayout(
151
+ scrollState: ScrollState?,
152
+ modifier: Modifier = Modifier,
153
+ contentModifier: Modifier = Modifier,
154
+ verticalArrangement: Arrangement.Vertical = Arrangement.Top,
155
+ horizontalAlignment: Alignment.Horizontal = Alignment.Start,
156
+ title: String? = null,
157
+ tintColor: Color? = null,
158
+ headerRightData: HeaderRightData? = null,
159
+ headerType: HeaderType = HeaderType.DEFAULT,
160
+ titlePosition: TitlePosition = TitlePosition.LEFT,
161
+ useAnimationSearch: Boolean = true,
162
+ onGoBack: (() -> Unit)? = null,
163
+ headerBackgroundColor: Color? = null,
164
+ headerSpaceBetween: Dp? = null,
165
+ inputSearchProps: LiteInputSearchProps? = null,
166
+ headerRight: @Composable (() -> Unit)? = null,
167
+ content: @Composable () -> Unit,
168
+ ) {
169
+ val statusBarHeight = getAppStatusBarHeight()
170
+ val isHeaderNone = remember(headerType) {
171
+ headerType == HeaderType.NONE
172
+ }
173
+ val theme = AppTheme.current
174
+ val density = LocalDensity.current
175
+
176
+ val isHeaderExtend = remember(headerType) {
177
+ headerType == HeaderType.EXTENDED
178
+ }
179
+ val backgroundHeight = remember(isHeaderNone, isHeaderExtend, statusBarHeight) {
180
+ when {
181
+ isHeaderNone -> statusBarHeight
182
+ !isHeaderExtend -> statusBarHeight + HEADER_HEIGHT.dp
183
+ else -> HeaderId.EXTENDED_HEADER_HEIGHT
184
+ }
185
+ }
186
+ val listGradientColors = remember {
187
+ listOf(
188
+ Color(0xFFFDCADE),
189
+ Color(0x00FDCADE),
190
+ )
191
+ }
192
+
193
+ val headerColor = remember(tintColor, theme) {
194
+ if (tintColor == Colors.black_01) HeaderColor(
195
+ tintIconColor = tintColor,
196
+ backgroundButton = Colors.black_20.copy(alpha = 0.6f),
197
+ borderColor = Colors.black_01.copy(alpha = 0.2f)
198
+ )
199
+ else HeaderColor(
200
+ tintIconColor = tintColor ?: theme.colors.text.default,
201
+ backgroundButton = Colors.black_01.copy(alpha = 0.6f),
202
+ borderColor = Colors.black_20.copy(alpha = 0.2f)
203
+ )
204
+ }
205
+
206
+ val scrollPercentage = produceState(
207
+ initialValue = 0f,
208
+ key1 = useAnimationSearch,
209
+ key2 = scrollState,
210
+ key3 = backgroundHeight,
211
+ ) {
212
+ if (!useAnimationSearch) return@produceState
213
+ scrollState ?: return@produceState
214
+ val rangePx = with(density) { backgroundHeight.toPx() }
215
+ snapshotFlow { scrollState.value }.collectLatest {
216
+ value = (it / rangePx).coerceIn(0f, 1f)
217
+ }
218
+ }
219
+
220
+ val titleStyle = remember {
221
+ Typography.actionSBold.copy(
222
+ fontSize = 15.sp,
223
+ lineHeight = 22.sp,
224
+ )
225
+ }
226
+
227
+ val animationOption = LocalAnimationOption.current
228
+ val animationOpacityModifier = Modifier.graphicsLayer {
229
+ alpha = animationOption?.animateOpacity ?: 1f
230
+ }
231
+ val titleModifier = Modifier
232
+ .kitsAutomationId("title_navigation_header")
233
+ .layoutId(HeaderId.TITLE_ID)
234
+ .graphicsLayer {
235
+ val titleAlpha = if (isHeaderExtend && inputSearchProps != null && useAnimationSearch)
236
+ (1 - scrollPercentage.value * 2).coerceIn(0f, 1f)
237
+ else 1f
238
+ alpha = titleAlpha * (animationOption?.progress?.value ?: 1f)
239
+ }
240
+
241
+ val policy = remember(
242
+ useAnimationSearch,
243
+ isHeaderNone,
244
+ isHeaderExtend,
245
+ statusBarHeight,
246
+ titlePosition,
247
+ scrollPercentage,
248
+ headerSpaceBetween,
249
+ animationOption,
250
+ verticalArrangement,
251
+ horizontalAlignment,
252
+ ) {
253
+ LiteScreenLayoutPolicy(
254
+ useAnimationSearch = useAnimationSearch,
255
+ isHeaderNone = isHeaderNone,
256
+ isHeaderExtend = isHeaderExtend,
257
+ statusBarHeight = statusBarHeight,
258
+ titlePosition = titlePosition,
259
+ scrollPercentage = scrollPercentage,
260
+ headerSpaceBetween = headerSpaceBetween,
261
+ animationOption = animationOption,
262
+ verticalArrangement = verticalArrangement,
263
+ horizontalAlignment = horizontalAlignment,
264
+ )
265
+ }
266
+
267
+ Layout(
268
+ modifier = modifier
269
+ .animateContentSize(),
270
+ content = {
271
+ Box(
272
+ modifier = animationOpacityModifier
273
+ .layoutId(HeaderId.CONTENT_ID)
274
+ .then(contentModifier),
275
+ contentAlignment = Alignment.TopCenter,
276
+ ) {
277
+ content()
278
+ }
279
+
280
+ if (!isHeaderNone) {
281
+ Box(
282
+ modifier = Modifier
283
+ .layoutId(HeaderId.BACKGROUND_ID)
284
+ .then(animationOpacityModifier)
285
+ .drawBehind {
286
+ val headerHeight = max(
287
+ HeaderId.EXTENDED_HEADER_HEIGHT.toPx(),
288
+ size.height,
289
+ )
290
+ headerBackgroundColor?.let {
291
+ drawRect(color = it)
292
+ } ?: run {
293
+ drawRect(color = Colors.black_01)
294
+ drawRect(
295
+ brush = Brush.linearGradient(
296
+ colors = listGradientColors,
297
+ start = Offset.Zero,
298
+ end = Offset(
299
+ x = 0f,
300
+ y = headerHeight * (1 - scrollPercentage.value),
301
+ ),
302
+ )
303
+ )
304
+ }
305
+ },
306
+ )
307
+ }
308
+
309
+ if (!isHeaderNone && onGoBack != null) {
310
+ val coreModifier = Modifier
311
+ .layoutId(HeaderId.BACK_ID)
312
+ .then(animationOpacityModifier)
313
+ .clip(CircleShape)
314
+ .noFeedbackClickable(onClick = onGoBack)
315
+ .setAutomationId("btn_navigation_back")
316
+ inputSearchProps?.customBackIcon?.invoke(coreModifier) ?: Box(
317
+ modifier = coreModifier
318
+ .size(28.dp)
319
+ .border(
320
+ width = 0.2.dp,
321
+ color = headerColor.borderColor,
322
+ shape = CircleShape,
323
+ )
324
+ .background(color = headerColor.backgroundButton)
325
+ .padding(Spacing.XS),
326
+ ) {
327
+ Icon(
328
+ source = "arrow-back",
329
+ color = headerColor.tintIconColor,
330
+ size = 20.dp,
331
+ )
332
+ }
333
+ }
334
+
335
+ if (!isHeaderNone) {
336
+ Box(
337
+ modifier = Modifier
338
+ .layoutId(HeaderId.HEADER_RIGHT_ID)
339
+ .then(animationOpacityModifier)
340
+ ) {
341
+ if (headerRight != null) {
342
+ headerRight()
343
+ } else {
344
+ HeaderRight(
345
+ headerRight = headerRightData,
346
+ tintColor = tintColor,
347
+ )
348
+ }
349
+ }
350
+ }
351
+
352
+ if (!isHeaderNone && inputSearchProps != null) {
353
+ LiteInputSearch(
354
+ modifier = Modifier.layoutId(HeaderId.INPUT_SEARCH_ID),
355
+ inputSearchProps = inputSearchProps,
356
+ )
357
+ }
358
+ if (!isHeaderNone && title != null && (inputSearchProps == null || isHeaderExtend)) {
359
+ Text(
360
+ text = title,
361
+ color = headerColor.tintIconColor,
362
+ style = titleStyle,
363
+ modifier = titleModifier,
364
+ maxLines = 1,
365
+ overflow = TextOverflow.Ellipsis
366
+ )
367
+ }
368
+ },
369
+ measurePolicy = policy,
370
+ )
371
+ }
372
+
373
+ private class LiteScreenLayoutPolicy(
374
+ private val useAnimationSearch: Boolean,
375
+ private val isHeaderNone: Boolean,
376
+ private val isHeaderExtend: Boolean,
377
+ private val statusBarHeight: Dp,
378
+ private val scrollPercentage: State<Float>,
379
+ private val titlePosition: TitlePosition,
380
+ private val headerSpaceBetween: Dp? = null,
381
+ private val animationOption: AnimationOption?,
382
+ private val verticalArrangement: Arrangement.Vertical,
383
+ private val horizontalAlignment: Alignment.Horizontal,
384
+ ) : MeasurePolicy {
385
+
386
+ val searchStartPosition: IntOffset by lazy {
387
+ if (animationOption == null) return@lazy IntOffset.Zero
388
+ val offset = animationOption.targetBounds.topLeft
389
+ IntOffset(
390
+ x = offset.x.roundToInt(),
391
+ y = offset.y.roundToInt(),
392
+ )
393
+ }
394
+
395
+ override fun MeasureScope.measure(
396
+ measurables: List<Measurable>,
397
+ constraints: Constraints
398
+ ): MeasureResult {
399
+ val spacing12 = Spacing.M.roundToPx()
400
+ val spaceBetween = headerSpaceBetween?.roundToPx() ?: spacing12
401
+ val statusBarPx = statusBarHeight.roundToPx()
402
+ val headerRowDefault = HEADER_HEIGHT.dp.roundToPx()
403
+ val scrollPercent = scrollPercentage.value
404
+
405
+ val contentMeasurable = measurables.find { it.layoutId == HeaderId.CONTENT_ID }
406
+
407
+ val realConstraints = constraints.copy(
408
+ minWidth = 0,
409
+ minHeight = 0,
410
+ maxWidth = (constraints.maxWidth - spacing12 * 2)
411
+ .coerceAtLeast(0),
412
+ )
413
+ val backIconPlaceable =
414
+ measurables.find { it.layoutId == HeaderId.BACK_ID }?.measure(realConstraints)
415
+ val headerRightPlaceable =
416
+ measurables.find { it.layoutId == HeaderId.HEADER_RIGHT_ID }?.measure(
417
+ realConstraints.copy(
418
+ maxWidth = realConstraints.maxWidth / 2,
419
+ )
420
+ )
421
+ val baseInputSearchConstraints = if (isHeaderExtend) {
422
+ val minWidth =
423
+ if (useAnimationSearch) realConstraints.maxWidth - backIconPlaceable.safeWidth - headerRightPlaceable.safeWidth - spaceBetween * 2
424
+ else realConstraints.maxWidth
425
+ realConstraints.copy(
426
+ maxWidth = (realConstraints.maxWidth * (1 - scrollPercent)).toInt()
427
+ .coerceAtLeast(minWidth)
428
+ )
429
+ } else {
430
+ var spaceConsumed = 0
431
+ if (backIconPlaceable.safeWidth != 0) spaceConsumed += backIconPlaceable.safeWidth + spaceBetween
432
+ if (headerRightPlaceable.safeWidth != 0) spaceConsumed += headerRightPlaceable.safeWidth + spaceBetween
433
+ realConstraints.copy(
434
+ maxWidth = realConstraints.maxWidth - spaceConsumed
435
+ )
436
+ }
437
+ val inputSearchConstraints = baseInputSearchConstraints.withAnimationTargetBounds()
438
+ val inputSearchPlaceable = measurables.find { it.layoutId == HeaderId.INPUT_SEARCH_ID }
439
+ ?.measure(inputSearchConstraints)
440
+ val titlePlaceable = measurables.find { it.layoutId == HeaderId.TITLE_ID }?.measure(
441
+ constraints = realConstraints.copy(
442
+ maxWidth = realConstraints.maxWidth - backIconPlaceable.safeWidth - headerRightPlaceable.safeWidth - spaceBetween * 2
443
+ )
444
+ )
445
+
446
+ /**
447
+ * replicate logic from [vn.momo.kits.navigation.component.HeaderBackground]
448
+ * */
449
+ var defaultHeight = statusBarPx + headerRowDefault
450
+ if (isHeaderExtend) {
451
+ defaultHeight = 154.dp.roundToPx()
452
+ }
453
+ val headerHeight = when {
454
+ isHeaderNone -> statusBarPx
455
+ !useAnimationSearch && !isHeaderExtend -> defaultHeight
456
+ else -> {
457
+ val collapsableSpace = defaultHeight - statusBarPx - headerRowDefault
458
+ (defaultHeight - scrollPercent * collapsableSpace).toInt()
459
+ }
460
+ }
461
+
462
+ val layoutWidth = constraints.maxWidth
463
+ val layoutHeight = constraints.maxHeight
464
+ val contentHeight = (layoutHeight - headerHeight).coerceAtLeast(0)
465
+ val contentPlaceable = contentMeasurable?.measure(
466
+ constraints.copy(
467
+ minWidth = 0,
468
+ minHeight = contentHeight,
469
+ maxHeight = contentHeight,
470
+ )
471
+ )
472
+ val backgroundPlaceable = measurables.find { it.layoutId == HeaderId.BACKGROUND_ID }
473
+ ?.measure(
474
+ Constraints.fixed(
475
+ width = layoutWidth,
476
+ height = headerHeight,
477
+ )
478
+ )
479
+ val childrenHeights = intArrayOf(
480
+ headerHeight,
481
+ contentPlaceable.safeHeight,
482
+ )
483
+ val childrenY = IntArray(childrenHeights.size)
484
+ with(verticalArrangement) {
485
+ arrange(
486
+ totalSize = layoutHeight,
487
+ sizes = childrenHeights,
488
+ outPositions = childrenY,
489
+ )
490
+ }
491
+ val headerY = childrenY[0]
492
+ val contentY = childrenY[1]
493
+
494
+ return layout(
495
+ width = layoutWidth,
496
+ height = layoutHeight,
497
+ ) {
498
+ val progress = animationOption?.progress?.value ?: 1f
499
+
500
+ val startX = spacing12
501
+ val startY = headerY + statusBarPx
502
+ var curX = startX
503
+ var curY = startY
504
+
505
+ contentPlaceable?.place(
506
+ x = horizontalAlignment.align(
507
+ size = contentPlaceable.width,
508
+ space = layoutWidth,
509
+ layoutDirection = layoutDirection,
510
+ ),
511
+ y = contentY,
512
+ )
513
+
514
+ backgroundPlaceable?.place(
515
+ x = 0,
516
+ y = headerY,
517
+ )
518
+
519
+ if (backIconPlaceable != null) {
520
+ backIconPlaceable.place(
521
+ x = startX,
522
+ y = startY + backIconPlaceable.verticalCenterOffset(headerRowDefault),
523
+ )
524
+ curX += backIconPlaceable.safeWidth + spaceBetween
525
+ }
526
+
527
+ headerRightPlaceable?.place(
528
+ x = layoutWidth - spacing12 - headerRightPlaceable.safeWidth,
529
+ y = startY + headerRightPlaceable.verticalCenterOffset(headerRowDefault),
530
+ )
531
+
532
+ val titleOffset = IntOffset(
533
+ x = if (titlePosition == TitlePosition.LEFT) curX
534
+ else titlePlaceable.horizontalCenterOffset(
535
+ space = layoutWidth,
536
+ layoutDirection = layoutDirection,
537
+ ),
538
+ y = startY + titlePlaceable.verticalCenterOffset(headerRowDefault),
539
+ )
540
+
541
+ titlePlaceable?.place(titleOffset)
542
+
543
+ if (backIconPlaceable != null || headerRightPlaceable != null || titlePlaceable != null) {
544
+ curY += headerRowDefault
545
+ }
546
+
547
+ val inputSearchOffset = if (isHeaderExtend) {
548
+ val baseY = curY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
549
+ val y = (baseY * (1 - scrollPercent)).toInt().coerceAtLeast(
550
+ startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
551
+ )
552
+ IntOffset(
553
+ x = startX + ((backIconPlaceable.safeWidth + spaceBetween) * (scrollPercent * 2f).coerceIn(
554
+ 0f, 1f
555
+ )).toInt(),
556
+ y = y,
557
+ )
558
+ } else {
559
+ IntOffset(
560
+ x = curX,
561
+ y = startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault),
562
+ )
563
+ }
564
+ val finalPosition = lerp(
565
+ searchStartPosition,
566
+ inputSearchOffset,
567
+ progress,
568
+ )
569
+
570
+ inputSearchPlaceable?.place(
571
+ finalPosition
572
+ )
573
+ }
574
+ }
575
+
576
+ private val Placeable?.safeHeight
577
+ get() = this?.height ?: 0
578
+ private val Placeable?.safeWidth
579
+ get() = this?.width ?: 0
580
+
581
+ private fun Constraints.withAnimationTargetBounds(): Constraints {
582
+ val option = animationOption ?: return this
583
+ val progress = option.progress.value
584
+ if (progress >= 1f) return this
585
+
586
+ val targetWidth = option.targetBounds.width.roundToInt().coerceAtLeast(0)
587
+ val targetHeight = option.targetBounds.height.roundToInt().coerceAtLeast(0)
588
+ val animatedMinWidth = lerpPx(targetWidth, minWidth, progress)
589
+ .coerceInBounds(maxWidth)
590
+ val animatedMaxWidth = lerpMaxPx(targetWidth, maxWidth, progress)
591
+ .coerceAtLeast(animatedMinWidth)
592
+ val animatedMinHeight = lerpPx(targetHeight, minHeight, progress)
593
+ .coerceInBounds(maxHeight)
594
+ val animatedMaxHeight = lerpMaxPx(targetHeight, maxHeight, progress)
595
+ .coerceAtLeast(animatedMinHeight)
596
+
597
+ return copy(
598
+ minWidth = animatedMinWidth,
599
+ maxWidth = animatedMaxWidth,
600
+ minHeight = animatedMinHeight,
601
+ maxHeight = animatedMaxHeight,
602
+ )
603
+ }
604
+
605
+ private fun lerpPx(
606
+ start: Int,
607
+ stop: Int,
608
+ fraction: Float,
609
+ ): Int = androidx.compose.ui.util.lerp(
610
+ start.toFloat(),
611
+ stop.toFloat(),
612
+ fraction,
613
+ ).roundToInt()
614
+
615
+ private fun lerpMaxPx(
616
+ start: Int,
617
+ stop: Int,
618
+ fraction: Float,
619
+ ): Int {
620
+ if (stop == Constraints.Infinity) return Constraints.Infinity
621
+ return lerpPx(start, stop, fraction)
622
+ }
623
+
624
+ private fun Int.coerceInBounds(max: Int): Int {
625
+ if (max == Constraints.Infinity) return coerceAtLeast(0)
626
+ return coerceIn(0, max)
627
+ }
628
+
629
+ private fun Placeable?.verticalCenterOffset(space: Int): Int {
630
+ if (this == null) return 0
631
+ return Alignment.CenterVertically.align(safeHeight, space)
632
+ }
633
+
634
+ private fun Placeable?.horizontalCenterOffset(
635
+ space: Int,
636
+ layoutDirection: LayoutDirection
637
+ ): Int {
638
+ if (this == null) return 0
639
+ return Alignment.CenterHorizontally.align(safeWidth, space, layoutDirection)
640
+ }
641
+ }
642
+
643
+ private val EMPTY_FUNC = {}
644
+
645
+ @Stable
646
+ data class LiteInputSearchProps(
647
+ val textFieldState: MutableState<String>,
648
+ val onValueChange: (String) -> Unit,
649
+ val onClear: () -> Unit = EMPTY_FUNC,
650
+ val clearCondition: (() -> Boolean)? = null,
651
+ val modifier: Modifier = Modifier,
652
+ val onFocused: (() -> Unit) = EMPTY_FUNC,
653
+ val keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
654
+ val keyboardActions: KeyboardActions = KeyboardActions.Default,
655
+ val onKeyboardAction: (() -> Unit) = EMPTY_FUNC,
656
+
657
+ val btnText: String? = null,
658
+ val isShowBtnText: Boolean = !btnText.isNullOrEmpty(),
659
+ val onPressBtnText: (() -> Unit) = EMPTY_FUNC,
660
+
661
+ val disabled: Boolean = false,
662
+
663
+ val placeHolder: String? = null,
664
+
665
+ val cursorBrush: Brush? = null,
666
+ val customBackIcon: @Composable ((Modifier) -> Unit)? = null,
667
+ val customSearchIcon: @Composable (() -> Unit)? = null,
668
+ val customPlaceHolder: @Composable (() -> Unit)? = null,
669
+ val customTextStyle: TextStyle? = null,
670
+ val customIconClear: @Composable (() -> Unit)? = null,
671
+ val iconRightTextField: @Composable ((Modifier) -> Unit)? = null,
672
+ )
673
+
674
+ @Composable
675
+ private fun LiteInputSearch(
676
+ modifier: Modifier = Modifier,
677
+ inputSearchProps: LiteInputSearchProps? = null,
678
+ ) {
679
+ inputSearchProps ?: return
680
+ val theme = AppTheme.current
681
+
682
+ val isFocused = remember { mutableStateOf(false) }
683
+ val interactionSource = remember { MutableInteractionSource() }
684
+ val textState by remember { inputSearchProps.textFieldState }
685
+
686
+ val isShowBtnText by remember(inputSearchProps.isShowBtnText, inputSearchProps.btnText) {
687
+ derivedStateOf {
688
+ inputSearchProps.isShowBtnText && !inputSearchProps.btnText.isNullOrEmpty()
689
+ }
690
+ }
691
+ val inputFieldStyle = remember(theme) {
692
+ Typography.bodyDefaultRegular.copy(
693
+ color = theme.colors.text.default,
694
+ )
695
+ }
696
+
697
+ LaunchedEffect(inputSearchProps.onFocused) {
698
+ interactionSource.interactions.mapNotNull { it as? FocusInteraction }.collectLatest {
699
+ val isFocus = it is FocusInteraction.Focus
700
+ isFocused.value = isFocus
701
+ if (isFocus) inputSearchProps.onFocused()
702
+ }
703
+ }
704
+
705
+ Row(
706
+ modifier = modifier,
707
+ verticalAlignment = Alignment.CenterVertically,
708
+ ) {
709
+ val textFieldModifier = remember(inputSearchProps.modifier) {
710
+ inputSearchProps.modifier
711
+ .weight(1f)
712
+ }
713
+ BasicTextField(
714
+ value = textState,
715
+ onValueChange = inputSearchProps.onValueChange,
716
+ enabled = !inputSearchProps.disabled,
717
+ keyboardOptions = inputSearchProps.keyboardOptions,
718
+ keyboardActions = inputSearchProps.keyboardActions,
719
+ modifier = textFieldModifier,
720
+ textStyle = inputSearchProps.customTextStyle ?: inputFieldStyle,
721
+ singleLine = true,
722
+ cursorBrush = inputSearchProps.cursorBrush ?: SolidColor(Color.Black),
723
+ interactionSource = interactionSource,
724
+ decorationBox = { innerTextField ->
725
+ val isShowClear by remember(inputSearchProps.clearCondition, isFocused.value) {
726
+ derivedStateOf {
727
+ inputSearchProps.clearCondition?.invoke() == true || (isFocused.value && textState.isNotEmpty())
728
+ }
729
+ }
730
+ val placeHolder by produceState<String?>(null, inputSearchProps.placeHolder) {
731
+ if (inputSearchProps.placeHolder.isNullOrEmpty()) return@produceState
732
+ snapshotFlow { textState }.collectLatest {
733
+ value = if (it.isEmpty()) inputSearchProps.placeHolder else null
734
+ }
735
+ }
736
+ val iconRightModifier = remember {
737
+ Modifier
738
+ .padding(start = Spacing.L)
739
+ .drawWithContent {
740
+ val offsetX = -Spacing.S.toPx()
741
+ drawLine(
742
+ start = Offset(
743
+ x = offsetX,
744
+ y = 0f,
745
+ ),
746
+ end = Offset(
747
+ x = offsetX,
748
+ y = size.height,
749
+ ),
750
+ color = theme.colors.primary,
751
+ strokeWidth = 1.dp.toPx(),
752
+ )
753
+ drawContent()
754
+ }
755
+ }
756
+
757
+ Row(
758
+ modifier = Modifier
759
+ .padding(
760
+ horizontal = Spacing.M,
761
+ vertical = Spacing.S,
762
+ ),
763
+ horizontalArrangement = Arrangement.Start,
764
+ verticalAlignment = Alignment.CenterVertically,
765
+ ) {
766
+ inputSearchProps.customSearchIcon?.invoke() ?: Icon(
767
+ source = "navigation_search",
768
+ modifier = Modifier.padding(end = Spacing.XS),
769
+ size = 24.dp,
770
+ color = theme.colors.text.hint
771
+ )
772
+ Box(
773
+ modifier = Modifier.weight(1f),
774
+ contentAlignment = Alignment.CenterStart,
775
+ ) {
776
+ if (!placeHolder.isNullOrEmpty()) {
777
+ inputSearchProps.customPlaceHolder?.invoke() ?: Text(
778
+ text = placeHolder ?: "",
779
+ style = inputSearchProps.customTextStyle
780
+ ?: Typography.bodyDefaultRegular,
781
+ maxLines = 1,
782
+ color = theme.colors.text.hint,
783
+ overflow = TextOverflow.Ellipsis
784
+ )
785
+ }
786
+ innerTextField()
787
+ }
788
+
789
+ if (isShowClear) {
790
+ inputSearchProps.customIconClear?.invoke() ?: Icon(
791
+ source = "24_navigation_close_circle_full",
792
+ size = 16.dp,
793
+ color = theme.colors.text.hint,
794
+ modifier = Modifier.padding(start = Spacing.XS)
795
+ .noFeedbackClickable(onClick = inputSearchProps.onClear),
796
+ )
797
+ }
798
+
799
+ inputSearchProps.iconRightTextField?.invoke(iconRightModifier)
800
+ }
801
+ }
802
+ )
803
+
804
+ if (isShowBtnText) {
805
+ Text(
806
+ text = inputSearchProps.btnText ?: "",
807
+ style = Typography.actionDefaultBold,
808
+ color = theme.colors.text.default,
809
+ modifier = Modifier.padding(start = Spacing.L)
810
+ .noFeedbackClickable(onClick = inputSearchProps.onPressBtnText)
811
+ )
812
+ }
813
+ }
814
+ }
815
+
816
+ fun Modifier.hideKeyboardOnTap() = composed {
817
+ val focusManager = LocalFocusManager.current
818
+ val keyboardManager = LocalSoftwareKeyboardController.current
819
+
820
+ pointerInput(Unit) {
821
+ detectTapGestures {
822
+ keyboardManager?.hide()
823
+ focusManager.clearFocus()
824
+ }
825
+ }
826
+ }