@momo-kits/native-kits 0.155.1-hello.3-debug → 0.155.1-hello.5-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.
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +8 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +19 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +2 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +3 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +18 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +4 -23
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/compose.podspec
CHANGED
|
@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.height
|
|
|
13
13
|
import androidx.compose.foundation.layout.offset
|
|
14
14
|
import androidx.compose.foundation.layout.padding
|
|
15
15
|
import androidx.compose.foundation.layout.size
|
|
16
|
+
import androidx.compose.foundation.layout.width
|
|
16
17
|
import androidx.compose.foundation.layout.wrapContentSize
|
|
17
18
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
19
|
import androidx.compose.foundation.text.BasicTextField
|
|
@@ -28,18 +29,13 @@ import androidx.compose.ui.Alignment
|
|
|
28
29
|
import androidx.compose.ui.Modifier
|
|
29
30
|
import androidx.compose.ui.focus.onFocusChanged
|
|
30
31
|
import androidx.compose.ui.graphics.Color
|
|
31
|
-
import androidx.compose.ui.text.AnnotatedString
|
|
32
|
-
import androidx.compose.ui.text.SpanStyle
|
|
33
32
|
import androidx.compose.ui.text.TextStyle
|
|
34
|
-
import androidx.compose.ui.text.font.FontFamily
|
|
35
33
|
import androidx.compose.ui.text.font.FontWeight
|
|
36
34
|
import androidx.compose.ui.text.input.KeyboardType
|
|
37
|
-
import androidx.compose.ui.text.input.
|
|
38
|
-
import androidx.compose.ui.text.input.TransformedText
|
|
35
|
+
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
39
36
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
40
37
|
import androidx.compose.ui.text.style.TextAlign
|
|
41
38
|
import androidx.compose.ui.unit.Dp
|
|
42
|
-
import androidx.compose.ui.unit.TextUnit
|
|
43
39
|
import androidx.compose.ui.unit.dp
|
|
44
40
|
import androidx.compose.ui.unit.sp
|
|
45
41
|
import androidx.compose.ui.zIndex
|
|
@@ -50,12 +46,9 @@ import vn.momo.kits.application.ApplicationContext
|
|
|
50
46
|
import vn.momo.kits.application.MiniAppContext.Companion.isShowBaselineDebug
|
|
51
47
|
import vn.momo.kits.const.Colors
|
|
52
48
|
import vn.momo.kits.const.Typography
|
|
53
|
-
import vn.momo.kits.const.getFont
|
|
54
49
|
import vn.momo.kits.const.scaleSize
|
|
55
50
|
import vn.momo.kits.modifier.conditional
|
|
56
51
|
import vn.momo.kits.modifier.setAutomationId
|
|
57
|
-
import vn.momo.uikits.resources.Res
|
|
58
|
-
import vn.momo.uikits.resources.sfprotext_regular
|
|
59
52
|
|
|
60
53
|
data class InputSizeDetail(
|
|
61
54
|
val borderWidth: Dp,
|
|
@@ -96,38 +89,6 @@ data class InputState(
|
|
|
96
89
|
val hasBeenBlurred: Boolean = false
|
|
97
90
|
)
|
|
98
91
|
|
|
99
|
-
private class PasswordVisualTransformation(
|
|
100
|
-
private val fontFamily: FontFamily,
|
|
101
|
-
private val fontSize: TextUnit
|
|
102
|
-
) : VisualTransformation {
|
|
103
|
-
private val mask: Char = '\u2022'
|
|
104
|
-
|
|
105
|
-
override fun filter(text: AnnotatedString): TransformedText {
|
|
106
|
-
|
|
107
|
-
val maskedText = AnnotatedString(
|
|
108
|
-
text = mask.toString().repeat(text.length),
|
|
109
|
-
spanStyles = listOf(
|
|
110
|
-
AnnotatedString.Range(
|
|
111
|
-
SpanStyle(fontSize = fontSize, letterSpacing = 0.sp, fontFamily = fontFamily),
|
|
112
|
-
0,
|
|
113
|
-
text.length
|
|
114
|
-
)
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
return TransformedText(maskedText, OffsetMapping.Identity)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
override fun equals(other: Any?): Boolean {
|
|
121
|
-
if (this === other) return true
|
|
122
|
-
if (other !is PasswordVisualTransformation) return false
|
|
123
|
-
return mask == other.mask && fontSize == other.fontSize
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
override fun hashCode(): Int {
|
|
127
|
-
return 31 * mask.hashCode() + fontSize.hashCode()
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
92
|
@Composable
|
|
132
93
|
fun getBorderColor(isFocused: Boolean, error: String, disabled: Boolean): Color {
|
|
133
94
|
val theme = AppTheme.current
|
|
@@ -258,7 +219,7 @@ fun Input(
|
|
|
258
219
|
if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
259
220
|
}
|
|
260
221
|
|
|
261
|
-
val fontSize =
|
|
222
|
+
val fontSize = 16.sp
|
|
262
223
|
val lineHeight = 24.sp
|
|
263
224
|
val scaleFontSize = scaleSize(fontSize)
|
|
264
225
|
val scaleLineHeight = scaleSize(lineHeight)
|
|
@@ -283,15 +244,13 @@ fun Input(
|
|
|
283
244
|
|
|
284
245
|
val keyboardOptionsConfig = remember(secureTextEntry, keyboardType) {
|
|
285
246
|
KeyboardOptions.Default.copy(
|
|
286
|
-
keyboardType = keyboardType
|
|
247
|
+
keyboardType = if (secureTextEntry) KeyboardType.Ascii else keyboardType
|
|
287
248
|
)
|
|
288
249
|
}
|
|
289
250
|
|
|
290
|
-
val
|
|
291
|
-
val passwordFontSize = scaleSize(24.sp)
|
|
292
|
-
val visualTransformation = remember(secureTextEntry, inputState.passHidden, passwordFontFamily) {
|
|
251
|
+
val visualTransformation = remember(secureTextEntry, inputState.passHidden) {
|
|
293
252
|
if (secureTextEntry && !inputState.passHidden)
|
|
294
|
-
PasswordVisualTransformation(
|
|
253
|
+
PasswordVisualTransformation()
|
|
295
254
|
else
|
|
296
255
|
VisualTransformation.None
|
|
297
256
|
}
|
|
@@ -408,7 +367,8 @@ fun Input(
|
|
|
408
367
|
|
|
409
368
|
// Clear button
|
|
410
369
|
if (inputState.isFocused && text.value.isNotEmpty()) {
|
|
411
|
-
Row
|
|
370
|
+
Row {
|
|
371
|
+
Spacer(Modifier.width(Spacing.XS))
|
|
412
372
|
Icon(
|
|
413
373
|
source = "24_navigation_close_circle_full",
|
|
414
374
|
size = 16.dp,
|
|
@@ -77,21 +77,17 @@ private fun heightForLines(
|
|
|
77
77
|
return heightPx
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
data class PopupNotifyProps(
|
|
81
|
-
val image: String = "",
|
|
82
|
-
val title: String = "Title",
|
|
83
|
-
val description: String = "Description",
|
|
84
|
-
val error: String = "",
|
|
85
|
-
val primary: PopupAction? = null,
|
|
86
|
-
val secondary: PopupAction? = null,
|
|
87
|
-
val buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
|
|
88
|
-
val onIconClose: () -> Unit,
|
|
89
|
-
val isShowCloseIcon: Boolean = true,
|
|
90
|
-
)
|
|
91
|
-
|
|
92
80
|
@Composable
|
|
93
81
|
fun PopupNotify(
|
|
94
|
-
|
|
82
|
+
image: String = "",
|
|
83
|
+
title: String = "Title",
|
|
84
|
+
description: String = "Description",
|
|
85
|
+
error: String = "",
|
|
86
|
+
primary: PopupAction? = null,
|
|
87
|
+
secondary: PopupAction? = null,
|
|
88
|
+
buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
|
|
89
|
+
onIconClose: () -> Unit,
|
|
90
|
+
isShowCloseIcon: Boolean = true,
|
|
95
91
|
) {
|
|
96
92
|
var isScroll by remember { mutableStateOf(false) }
|
|
97
93
|
val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
|
|
@@ -126,7 +122,7 @@ fun PopupNotify(
|
|
|
126
122
|
) {
|
|
127
123
|
item {
|
|
128
124
|
Text(
|
|
129
|
-
text =
|
|
125
|
+
text = description,
|
|
130
126
|
onTextLayout = { layoutResult.value = it },
|
|
131
127
|
style = Typography.bodyDefaultRegular
|
|
132
128
|
)
|
|
@@ -137,7 +133,7 @@ fun PopupNotify(
|
|
|
137
133
|
{ modifier ->
|
|
138
134
|
Box(modifier = modifier) {
|
|
139
135
|
Text(
|
|
140
|
-
text =
|
|
136
|
+
text = description,
|
|
141
137
|
onTextLayout = { layoutResult.value = it },
|
|
142
138
|
style = Typography.bodyDefaultRegular
|
|
143
139
|
)
|
|
@@ -167,9 +163,9 @@ fun PopupNotify(
|
|
|
167
163
|
border(1.dp, Colors.blue_03)
|
|
168
164
|
}
|
|
169
165
|
) {
|
|
170
|
-
if(
|
|
166
|
+
if(image.isNotEmpty()) {
|
|
171
167
|
Image(
|
|
172
|
-
source =
|
|
168
|
+
source = image,
|
|
173
169
|
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
|
|
174
170
|
options = Options(alignment = Alignment.Center)
|
|
175
171
|
)
|
|
@@ -179,13 +175,13 @@ fun PopupNotify(
|
|
|
179
175
|
Text(
|
|
180
176
|
style = Typography.headerDefaultBold,
|
|
181
177
|
maxLines = 2,
|
|
182
|
-
text =
|
|
178
|
+
text = title,
|
|
183
179
|
modifier = Modifier.setAutomationId("title_popup_permission")
|
|
184
180
|
)
|
|
185
181
|
content(Modifier.padding(top = Spacing.S))
|
|
186
|
-
if (
|
|
182
|
+
if (error.isNotEmpty()) {
|
|
187
183
|
Text(
|
|
188
|
-
text = errorCode[language] +
|
|
184
|
+
text = errorCode[language] + error,
|
|
189
185
|
style = Typography.descriptionXsRegular,
|
|
190
186
|
color = AppTheme.current.colors.text.hint,
|
|
191
187
|
maxLines = 1,
|
|
@@ -198,13 +194,13 @@ fun PopupNotify(
|
|
|
198
194
|
modifier = Modifier.padding(horizontal = Spacing.XL)
|
|
199
195
|
.padding(bottom = Spacing.XL)
|
|
200
196
|
) {
|
|
201
|
-
BuildAction(
|
|
197
|
+
BuildAction(primary, secondary, buttonDirection, onAction = { callback ->
|
|
202
198
|
onClose(callback)
|
|
203
199
|
})
|
|
204
200
|
}
|
|
205
201
|
}
|
|
206
202
|
|
|
207
|
-
if(
|
|
203
|
+
if(isShowCloseIcon) {
|
|
208
204
|
Box(
|
|
209
205
|
Modifier
|
|
210
206
|
.width(22.dp)
|
|
@@ -223,7 +219,7 @@ fun PopupNotify(
|
|
|
223
219
|
.clickable(
|
|
224
220
|
interactionSource = remember { MutableInteractionSource() },
|
|
225
221
|
indication = null,
|
|
226
|
-
onClick = { onClose {
|
|
222
|
+
onClick = { onClose { onIconClose() } }
|
|
227
223
|
),
|
|
228
224
|
contentAlignment = Alignment.Center
|
|
229
225
|
) {
|
|
@@ -9,7 +9,6 @@ import androidx.compose.runtime.staticCompositionLocalOf
|
|
|
9
9
|
import androidx.compose.ui.graphics.Color
|
|
10
10
|
import vn.momo.kits.navigation.bottomtab.setBottomTabOption
|
|
11
11
|
import vn.momo.kits.navigation.component.FloatingButtonProps
|
|
12
|
-
import vn.momo.kits.navigation.component.HeaderBackProps
|
|
13
12
|
import vn.momo.kits.navigation.component.HeaderRight
|
|
14
13
|
import vn.momo.kits.navigation.component.HeaderTitle
|
|
15
14
|
import vn.momo.kits.navigation.component.HeaderType
|
|
@@ -26,7 +25,6 @@ class Navigation(
|
|
|
26
25
|
fun setOptions(
|
|
27
26
|
onBackHandler: (() -> Unit)? = null,
|
|
28
27
|
hiddenBack: Boolean? = null,
|
|
29
|
-
headerBackProps: HeaderBackProps? = null,
|
|
30
28
|
headerTitle: HeaderTitle? = null,
|
|
31
29
|
headerRight: HeaderRight? = null,
|
|
32
30
|
headerType: HeaderType? = null,
|
|
@@ -41,7 +39,6 @@ class Navigation(
|
|
|
41
39
|
options.copy(
|
|
42
40
|
onBackHandler = onBackHandler ?: options.onBackHandler,
|
|
43
41
|
hiddenBack = hiddenBack ?: options.hiddenBack,
|
|
44
|
-
headerBackProps = headerBackProps ?: options.headerBackProps,
|
|
45
42
|
headerTitle = headerTitle ?: options.headerTitle,
|
|
46
43
|
headerRight = headerRight ?: options.headerRight,
|
|
47
44
|
headerType = headerType ?: options.headerType,
|
|
@@ -74,7 +71,6 @@ val LocalNavigation = staticCompositionLocalOf<Navigation> {
|
|
|
74
71
|
data class NavigationOptions(
|
|
75
72
|
val onBackHandler: (() -> Unit)? = null,
|
|
76
73
|
val hiddenBack: Boolean = false,
|
|
77
|
-
val headerBackProps: HeaderBackProps = HeaderBackProps(),
|
|
78
74
|
val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
|
|
79
75
|
val headerRight: HeaderRight = HeaderRight.Toolkit(),
|
|
80
76
|
val headerType: HeaderType = HeaderType.Default(),
|
|
@@ -16,8 +16,6 @@ import kotlinx.coroutines.cancel
|
|
|
16
16
|
import kotlinx.coroutines.delay
|
|
17
17
|
import kotlinx.coroutines.launch
|
|
18
18
|
import kotlinx.serialization.Serializable
|
|
19
|
-
import vn.momo.kits.components.PopupAction
|
|
20
|
-
import vn.momo.kits.components.PopupNotify
|
|
21
19
|
import vn.momo.kits.navigation.BottomHeader.*
|
|
22
20
|
import vn.momo.kits.navigation.component.SnackBar
|
|
23
21
|
import vn.momo.maxapi.IMaxApi
|
|
@@ -42,33 +40,6 @@ class Navigator(
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
fun onBackSafe(callBack: (() -> Unit)? = null) {
|
|
46
|
-
val latestScreen = DynamicScreenRegistry.getLatestScreen()
|
|
47
|
-
val options = latestScreen?.options
|
|
48
|
-
if (options?.onBackHandler != null) {
|
|
49
|
-
options.onBackHandler.invoke()
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
val preventBack = options?.headerBackProps?.preventBack
|
|
53
|
-
if (preventBack != null) {
|
|
54
|
-
showModal(
|
|
55
|
-
content = {
|
|
56
|
-
PopupNotify(preventBack.copy(
|
|
57
|
-
primary = PopupAction(
|
|
58
|
-
title = preventBack.primary?.title ?: "",
|
|
59
|
-
onPress = {
|
|
60
|
-
preventBack.primary?.onPress?.invoke()
|
|
61
|
-
pop(2, callBack) // close popup notify, then close the screen
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
))
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
} else {
|
|
68
|
-
pop(1, callBack)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
43
|
fun pop(count: Int = 1, callBack: (() -> Unit)? = null) {
|
|
73
44
|
scope.launch {
|
|
74
45
|
repeat(count) {
|
|
@@ -85,13 +56,13 @@ class Navigator(
|
|
|
85
56
|
callBack?.invoke()
|
|
86
57
|
}
|
|
87
58
|
}
|
|
88
|
-
private suspend fun dismissOverplay(isDelay: Boolean = true) {
|
|
59
|
+
private suspend fun CoroutineScope.dismissOverplay(isDelay: Boolean = true) {
|
|
89
60
|
OverplayComponentRegistry.clear()
|
|
90
61
|
if (isDelay) delay(300L)
|
|
91
62
|
OverplayComponentRegistry.hardClearAfterDismiss()
|
|
92
63
|
}
|
|
93
64
|
|
|
94
|
-
private suspend fun dismissScreen() {
|
|
65
|
+
private suspend fun CoroutineScope.dismissScreen() {
|
|
95
66
|
if (navController.previousBackStackEntry != null){
|
|
96
67
|
navController.popBackStack()
|
|
97
68
|
delay(300L)
|
|
@@ -75,7 +75,6 @@ internal fun StackScreen(
|
|
|
75
75
|
navigationOptions: NavigationOptions? = null,
|
|
76
76
|
id: Int = -1,
|
|
77
77
|
bottomTabIndex: Int = -1,
|
|
78
|
-
onBackHandler: (() -> Unit)? = null,
|
|
79
78
|
) {
|
|
80
79
|
val navigator = LocalNavigator.current
|
|
81
80
|
val statusBar = AppStatusBar.current
|
|
@@ -96,7 +95,7 @@ internal fun StackScreen(
|
|
|
96
95
|
val footerHeightPx = remember { mutableIntStateOf(0) }
|
|
97
96
|
val headerRightWidthPx = remember { mutableIntStateOf(0) }
|
|
98
97
|
|
|
99
|
-
BackHandler(true) { navigator.
|
|
98
|
+
BackHandler(true) { navigator.pop() }
|
|
100
99
|
|
|
101
100
|
CompositionLocalProvider(
|
|
102
101
|
StackScreenScrollableState provides options.scrollData.scrollState,
|
|
@@ -121,7 +120,7 @@ internal fun StackScreen(
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
Box(Modifier.zIndex(5f)) {
|
|
124
|
-
Header(
|
|
123
|
+
Header()
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
Column (Modifier.zIndex(6f)) {
|
|
@@ -176,10 +175,7 @@ fun ColumnScope.MainContent(content: @Composable ()-> Unit){
|
|
|
176
175
|
val density = LocalDensity.current
|
|
177
176
|
val scrollState = LocalScrollState.current
|
|
178
177
|
|
|
179
|
-
Spacer(Modifier.height(
|
|
180
|
-
if (options.headerType is HeaderType.DefaultOrExtended || (options.headerType is HeaderType.Transparent && !options.headerType.isFullScreenContent))
|
|
181
|
-
AppStatusBar.current + HEADER_HEIGHT.dp else 0.dp)
|
|
182
|
-
)
|
|
178
|
+
Spacer(Modifier.height(if (options.headerType is HeaderType.DefaultOrExtended) AppStatusBar.current + HEADER_HEIGHT.dp else 0.dp))
|
|
183
179
|
if (inputSearchType == InputSearchType.Animated){
|
|
184
180
|
val scrollDp = with(density) { scrollState.value.toDp() }
|
|
185
181
|
|
|
@@ -54,7 +54,16 @@ fun BottomTab(
|
|
|
54
54
|
val navController = rememberNavController()
|
|
55
55
|
|
|
56
56
|
bottomTabOptionItems = items.mapIndexed { index, item ->
|
|
57
|
-
item.options ?: NavigationOptions()
|
|
57
|
+
val options = item.options ?: NavigationOptions()
|
|
58
|
+
options.copy(
|
|
59
|
+
onBackHandler = {
|
|
60
|
+
if (index != 0) {
|
|
61
|
+
navController.popBackStack()
|
|
62
|
+
} else {
|
|
63
|
+
navigator.pop()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
)
|
|
58
67
|
}.toMutableList()
|
|
59
68
|
|
|
60
69
|
|
|
@@ -105,23 +114,21 @@ fun BottomTab(
|
|
|
105
114
|
)
|
|
106
115
|
}
|
|
107
116
|
) {
|
|
108
|
-
val option = getBottomTabOption(index)
|
|
109
|
-
|
|
110
|
-
StackScreen(
|
|
111
|
-
content = item.screen,
|
|
112
|
-
navigationOptions = option,
|
|
113
|
-
bottomTabIndex = index,
|
|
117
|
+
val option = getBottomTabOption(index)?.copy(
|
|
114
118
|
onBackHandler = {
|
|
115
119
|
if (index != 0) {
|
|
116
|
-
navController.popBackStack(
|
|
117
|
-
navController.graph.startDestinationRoute!!,
|
|
118
|
-
inclusive = false
|
|
119
|
-
)
|
|
120
|
+
navController.popBackStack()
|
|
120
121
|
} else {
|
|
121
122
|
navigator.pop()
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
)
|
|
126
|
+
|
|
127
|
+
StackScreen(
|
|
128
|
+
content = item.screen,
|
|
129
|
+
navigationOptions = option,
|
|
130
|
+
bottomTabIndex = index
|
|
131
|
+
)
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
}
|
|
@@ -30,7 +30,6 @@ import vn.momo.kits.const.AppTheme
|
|
|
30
30
|
import vn.momo.kits.const.Colors
|
|
31
31
|
import vn.momo.kits.application.ApplicationContext
|
|
32
32
|
import vn.momo.kits.application.MiniAppContext.Companion.isShowBaselineDebug
|
|
33
|
-
import vn.momo.kits.components.PopupNotifyProps
|
|
34
33
|
import vn.momo.kits.const.Spacing
|
|
35
34
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
36
35
|
import vn.momo.kits.modifier.conditional
|
|
@@ -44,7 +43,7 @@ const val HEADER_HEIGHT = 52
|
|
|
44
43
|
enum class InputSearchType { None, Header, Animated }
|
|
45
44
|
|
|
46
45
|
@Composable
|
|
47
|
-
fun Header(
|
|
46
|
+
fun Header() {
|
|
48
47
|
val options = LocalOptions.current
|
|
49
48
|
val navigator = LocalNavigator.current
|
|
50
49
|
val scrollState = LocalScrollState.current
|
|
@@ -56,12 +55,7 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
|
56
55
|
else -> HEADER_HEIGHT
|
|
57
56
|
}
|
|
58
57
|
val opacity by animateFloatAsState(
|
|
59
|
-
targetValue =
|
|
60
|
-
0f
|
|
61
|
-
} else {
|
|
62
|
-
(scrollState.value / opacityHeight.toFloat())
|
|
63
|
-
.coerceIn(0f, 1f)
|
|
64
|
-
}
|
|
58
|
+
targetValue = ((scrollState.value * 1f / opacityHeight * 1f)).coerceIn(0f, 1f),
|
|
65
59
|
)
|
|
66
60
|
|
|
67
61
|
val headerColor = getHeaderColor(options.headerType, opacity, options.tintColor, Colors.black_17)
|
|
@@ -70,16 +64,11 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
|
70
64
|
|
|
71
65
|
val application = ApplicationContext.current
|
|
72
66
|
|
|
73
|
-
val background = if (options.headerType is HeaderType.Transparent)
|
|
74
|
-
options.backgroundColor ?: AppTheme.current.colors.background.surface
|
|
75
|
-
else
|
|
76
|
-
AppTheme.current.colors.background.surface
|
|
77
|
-
|
|
78
67
|
if (options.headerType == HeaderType.None) return
|
|
79
68
|
Box(
|
|
80
69
|
Modifier.height(AppStatusBar.current + HEADER_HEIGHT.dp)
|
|
81
70
|
.fillMaxWidth()
|
|
82
|
-
.background(background.copy(alpha = animatedAlpha))
|
|
71
|
+
.background(AppTheme.current.colors.background.surface.copy(alpha = animatedAlpha))
|
|
83
72
|
.conditional(application.isShowBaselineDebug()) {
|
|
84
73
|
border(1.dp, Colors.blue_03)
|
|
85
74
|
},
|
|
@@ -98,7 +87,7 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
|
98
87
|
backgroundButton = headerColor.backgroundButton,
|
|
99
88
|
tintIconColor = headerColor.tintIconColor,
|
|
100
89
|
onBackHandler = {
|
|
101
|
-
onBackHandler?.invoke() ?: navigator.
|
|
90
|
+
options.onBackHandler?.invoke() ?: navigator.pop()
|
|
102
91
|
}
|
|
103
92
|
)
|
|
104
93
|
}
|
|
@@ -234,16 +223,8 @@ sealed class HeaderType {
|
|
|
234
223
|
val layoutOffSet: Dp = 56.dp,
|
|
235
224
|
val composable: @Composable (scrollState: Int) -> Unit = {}
|
|
236
225
|
) : HeaderType()
|
|
237
|
-
|
|
238
|
-
data class Transparent(
|
|
239
|
-
val isFullScreenContent: Boolean = false
|
|
240
|
-
) : HeaderType()
|
|
241
226
|
}
|
|
242
227
|
|
|
243
|
-
data class HeaderBackProps(
|
|
244
|
-
val preventBack: PopupNotifyProps? = null,
|
|
245
|
-
)
|
|
246
|
-
|
|
247
228
|
data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
|
|
248
229
|
fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
|
|
249
230
|
return if(headerType is HeaderType.Animated) {
|
package/gradle.properties
CHANGED