@momo-kits/native-kits 0.113.1-beta.14 → 0.113.1-beta.16
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/Screenshot_20250305_142328.png +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +10 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +40 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +5 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +68 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +12 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -1
- package/ios/Image/Image.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +2 -1
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -61
|
Binary file
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package vn.momo.kits.application
|
|
2
2
|
|
|
3
|
-
import androidx.compose.animation.animateColorAsState
|
|
4
3
|
import androidx.compose.foundation.background
|
|
5
4
|
import androidx.compose.foundation.border
|
|
6
5
|
import androidx.compose.foundation.clickable
|
|
@@ -24,7 +23,6 @@ import androidx.compose.runtime.setValue
|
|
|
24
23
|
import androidx.compose.runtime.snapshotFlow
|
|
25
24
|
import androidx.compose.ui.Alignment
|
|
26
25
|
import androidx.compose.ui.Modifier
|
|
27
|
-
import androidx.compose.ui.graphics.Color
|
|
28
26
|
import androidx.compose.ui.graphics.graphicsLayer
|
|
29
27
|
import androidx.compose.ui.semantics.semantics
|
|
30
28
|
import androidx.compose.ui.semantics.testTag
|
|
@@ -42,15 +40,6 @@ import vn.momo.kits.const.Spacing
|
|
|
42
40
|
import vn.momo.kits.modifier.setAutomationId
|
|
43
41
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
44
42
|
|
|
45
|
-
enum class TitlePosition {
|
|
46
|
-
LEFT, CENTER,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
data class AnimatedHeader(
|
|
50
|
-
val type: HeaderType = HeaderType.DEFAULT,
|
|
51
|
-
val composable: @Composable (scrollState: Int) -> Unit = {}
|
|
52
|
-
)
|
|
53
|
-
|
|
54
43
|
@Composable
|
|
55
44
|
fun Header(
|
|
56
45
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -67,7 +56,6 @@ fun Header(
|
|
|
67
56
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
68
57
|
val tintIconColor = AppTheme.current.colors.text.default
|
|
69
58
|
val backgroundButton = Colors.black_01.copy(alpha = 0.6f)
|
|
70
|
-
val miniAppContext = ApplicationContext.current
|
|
71
59
|
|
|
72
60
|
var colorFraction by remember { mutableStateOf(0f) }
|
|
73
61
|
|
|
@@ -78,12 +66,10 @@ fun Header(
|
|
|
78
66
|
.collect { fraction -> colorFraction = fraction }
|
|
79
67
|
}
|
|
80
68
|
|
|
81
|
-
val backgroundSearch
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
colorFraction
|
|
86
|
-
)
|
|
69
|
+
val backgroundSearch = animateColor(
|
|
70
|
+
Colors.black_01,
|
|
71
|
+
AppTheme.current.colors.background.default,
|
|
72
|
+
colorFraction
|
|
87
73
|
)
|
|
88
74
|
|
|
89
75
|
if (headerType != HeaderType.NONE) {
|
|
@@ -132,9 +118,9 @@ fun Header(
|
|
|
132
118
|
}
|
|
133
119
|
}
|
|
134
120
|
|
|
135
|
-
if (
|
|
121
|
+
if (useAnimationSearch || inputSearchProps == null) {
|
|
136
122
|
Box(Modifier.graphicsLayer {
|
|
137
|
-
alpha = if (
|
|
123
|
+
alpha = if (animatedHeader !== null) opacity ?: 1f else 1f
|
|
138
124
|
}) {
|
|
139
125
|
headerRight?.invoke()
|
|
140
126
|
}
|
|
@@ -151,12 +137,13 @@ fun Header(
|
|
|
151
137
|
if (goBack != null && titlePosition == TitlePosition.LEFT) {
|
|
152
138
|
Spacer(Modifier.width(40.dp))
|
|
153
139
|
}
|
|
140
|
+
|
|
154
141
|
if (inputSearchProps != null && !useAnimationSearch) {
|
|
155
142
|
InputSearch(inputSearchProps = inputSearchProps.copy(backgroundColor = backgroundSearch))
|
|
156
143
|
} else {
|
|
157
144
|
Box(
|
|
158
145
|
Modifier.weight(1f).graphicsLayer {
|
|
159
|
-
alpha = if (useAnimationSearch
|
|
146
|
+
alpha = if (useAnimationSearch) {
|
|
160
147
|
1f - (opacity ?: 1f)
|
|
161
148
|
} else {
|
|
162
149
|
if (animatedHeader !== null) opacity ?: 1f else 1f
|
|
@@ -164,6 +151,7 @@ fun Header(
|
|
|
164
151
|
},
|
|
165
152
|
contentAlignment = if (titlePosition == TitlePosition.LEFT) Alignment.TopStart else Alignment.Center
|
|
166
153
|
) {
|
|
154
|
+
|
|
167
155
|
HeaderTitle(
|
|
168
156
|
title = title,
|
|
169
157
|
color = tintIconColor,
|
|
@@ -176,14 +164,4 @@ fun Header(
|
|
|
176
164
|
}
|
|
177
165
|
}
|
|
178
166
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
183
|
-
return Color(
|
|
184
|
-
red = start.red + fraction * (stop.red - start.red),
|
|
185
|
-
green = start.green + fraction * (stop.green - start.green),
|
|
186
|
-
blue = start.blue + fraction * (stop.blue - start.blue),
|
|
187
|
-
alpha = start.alpha + fraction * (stop.alpha - start.alpha)
|
|
188
|
-
)
|
|
189
|
-
}
|
|
167
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
package vn.momo.kits.application
|
|
2
2
|
|
|
3
|
+
import androidx.compose.animation.animateColorAsState
|
|
4
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
3
5
|
import androidx.compose.foundation.layout.Box
|
|
4
6
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
5
7
|
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.getValue
|
|
6
9
|
import androidx.compose.ui.Modifier
|
|
7
10
|
import androidx.compose.ui.graphics.Color
|
|
8
11
|
import androidx.compose.ui.unit.Dp
|
|
@@ -10,11 +13,25 @@ import androidx.compose.ui.unit.dp
|
|
|
10
13
|
import vn.momo.kits.components.InputSearchProps
|
|
11
14
|
import vn.momo.kits.const.AppStatusBar
|
|
12
15
|
import vn.momo.kits.const.AppTheme
|
|
13
|
-
import vn.momo.kits.platform.getScreenDimensions
|
|
14
16
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
enum class TitlePosition {
|
|
19
|
+
LEFT, CENTER,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
data class AnimatedHeader(
|
|
23
|
+
val type: HeaderType = HeaderType.DEFAULT,
|
|
24
|
+
val composable: @Composable (scrollState: Int) -> Unit = {}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
28
|
+
return Color(
|
|
29
|
+
red = start.red + fraction * (stop.red - start.red),
|
|
30
|
+
green = start.green + fraction * (stop.green - start.green),
|
|
31
|
+
blue = start.blue + fraction * (stop.blue - start.blue),
|
|
32
|
+
alpha = start.alpha + fraction * (stop.alpha - start.alpha)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
18
35
|
|
|
19
36
|
@Composable
|
|
20
37
|
fun HeaderBackground(
|
|
@@ -26,41 +43,39 @@ fun HeaderBackground(
|
|
|
26
43
|
useAnimationSearch: Boolean = false
|
|
27
44
|
) {
|
|
28
45
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
29
|
-
val screenWidth = getScreenDimensions().width
|
|
30
|
-
val leftPosition = if (isBack) (BACK_WIDTH + 20).dp else 20.dp
|
|
31
|
-
val searchWidth = screenWidth - (SCREEN_PADDING * 2)
|
|
32
46
|
|
|
33
|
-
val
|
|
34
|
-
|
|
35
|
-
statusBarHeight = statusBarHeight,
|
|
36
|
-
leftPosition = leftPosition,
|
|
37
|
-
searchWidth = searchWidth,
|
|
38
|
-
headerRightWidth = headerRightWidth
|
|
47
|
+
val opacityAni by animateFloatAsState(
|
|
48
|
+
targetValue = (1 - (scrollState / 52f)).coerceIn(0f, 1f),
|
|
39
49
|
)
|
|
40
50
|
|
|
41
|
-
val backgroundColor
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
val backgroundColor by animateColorAsState(
|
|
52
|
+
targetValue = animateColor(
|
|
53
|
+
Color.Transparent,
|
|
54
|
+
AppTheme.current.colors.background.surface,
|
|
55
|
+
opacityAni
|
|
56
|
+
),
|
|
57
|
+
)
|
|
46
58
|
|
|
47
59
|
when (headerType) {
|
|
48
60
|
HeaderType.DEFAULT -> {
|
|
49
|
-
val height = statusBarHeight + 52.dp
|
|
50
61
|
HeaderDefault(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
backgroundColor = backgroundColor
|
|
62
|
+
opacityAni = opacityAni,
|
|
63
|
+
statusBarHeight = statusBarHeight,
|
|
64
|
+
backgroundColor = backgroundColor,
|
|
54
65
|
)
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
HeaderType.EXTENDED -> {
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
HeaderExtended(
|
|
70
|
+
scrollState = scrollState,
|
|
60
71
|
inputSearchProps = inputSearchProps,
|
|
72
|
+
headerRightWidth = headerRightWidth,
|
|
61
73
|
useAnimationSearch = useAnimationSearch,
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
opacityAni = opacityAni,
|
|
75
|
+
isBack = isBack,
|
|
76
|
+
statusBarHeight = statusBarHeight,
|
|
77
|
+
backgroundColor = backgroundColor,
|
|
78
|
+
)
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
else -> {
|
|
@@ -21,10 +21,11 @@ import vn.momo.kits.utils.bottomBorder
|
|
|
21
21
|
|
|
22
22
|
@Composable
|
|
23
23
|
fun HeaderDefault(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
opacityAni: Float,
|
|
25
|
+
statusBarHeight: Dp,
|
|
26
|
+
backgroundColor: Color
|
|
27
27
|
) {
|
|
28
|
+
val height = statusBarHeight + 52.dp
|
|
28
29
|
Box(
|
|
29
30
|
modifier = Modifier.fillMaxWidth().height(height)
|
|
30
31
|
.background(backgroundColor)
|
|
@@ -37,7 +38,7 @@ fun HeaderDefault(
|
|
|
37
38
|
modifier = Modifier
|
|
38
39
|
.height(height)
|
|
39
40
|
.fillMaxWidth()
|
|
40
|
-
.alpha(
|
|
41
|
+
.alpha(opacityAni)
|
|
41
42
|
.background(
|
|
42
43
|
Brush.linearGradient(
|
|
43
44
|
colors = listOf(
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package vn.momo.kits.application
|
|
2
2
|
|
|
3
|
+
import androidx.compose.animation.animateColorAsState
|
|
4
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
3
5
|
import androidx.compose.foundation.background
|
|
4
6
|
import androidx.compose.foundation.layout.Box
|
|
5
7
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
@@ -9,6 +11,7 @@ import androidx.compose.foundation.layout.padding
|
|
|
9
11
|
import androidx.compose.foundation.layout.width
|
|
10
12
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
11
13
|
import androidx.compose.runtime.Composable
|
|
14
|
+
import androidx.compose.runtime.getValue
|
|
12
15
|
import androidx.compose.ui.Alignment
|
|
13
16
|
import androidx.compose.ui.Modifier
|
|
14
17
|
import androidx.compose.ui.draw.alpha
|
|
@@ -17,30 +20,71 @@ import androidx.compose.ui.graphics.Brush
|
|
|
17
20
|
import androidx.compose.ui.graphics.Color
|
|
18
21
|
import androidx.compose.ui.layout.ContentScale
|
|
19
22
|
import androidx.compose.ui.platform.LocalDensity
|
|
23
|
+
import androidx.compose.ui.unit.Dp
|
|
20
24
|
import androidx.compose.ui.unit.dp
|
|
21
25
|
import vn.momo.kits.components.Image
|
|
22
26
|
import vn.momo.kits.components.InputSearch
|
|
23
27
|
import vn.momo.kits.components.InputSearchProps
|
|
24
28
|
import vn.momo.kits.components.Options
|
|
25
29
|
import vn.momo.kits.const.AppTheme
|
|
30
|
+
import vn.momo.kits.const.Colors
|
|
26
31
|
import vn.momo.kits.const.Radius
|
|
27
32
|
import vn.momo.kits.const.Spacing
|
|
33
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
34
|
+
import vn.momo.kits.utils.bottomBorder
|
|
35
|
+
|
|
36
|
+
private const val SCREEN_PADDING = 12
|
|
37
|
+
private const val BACK_WIDTH = 28
|
|
28
38
|
|
|
29
39
|
@Composable
|
|
30
40
|
fun HeaderExtended(
|
|
31
|
-
|
|
32
|
-
inputSearchProps: InputSearchProps
|
|
33
|
-
useAnimationSearch: Boolean =
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
opacityAni: Float,
|
|
42
|
+
inputSearchProps: InputSearchProps?,
|
|
43
|
+
useAnimationSearch: Boolean = true,
|
|
44
|
+
scrollState: Int,
|
|
45
|
+
headerRightWidth: Dp,
|
|
46
|
+
isBack: Boolean,
|
|
47
|
+
statusBarHeight: Dp,
|
|
48
|
+
backgroundColor: Color
|
|
49
|
+
) {
|
|
50
|
+
val screenWidth = getScreenDimensions().width
|
|
51
|
+
val leftPosition = if (isBack) (BACK_WIDTH + 20).dp else 20.dp
|
|
52
|
+
val searchWidth = screenWidth - (SCREEN_PADDING * 2)
|
|
53
|
+
|
|
54
|
+
val backgroundSearch by animateColorAsState(
|
|
55
|
+
targetValue = animateColor(
|
|
56
|
+
AppTheme.current.colors.background.default,
|
|
57
|
+
Colors.black_01,
|
|
58
|
+
opacityAni
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
val animatedTranslateX by animateFloatAsState(
|
|
63
|
+
targetValue = (scrollState / 52f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
val animatedWidth by animateFloatAsState(
|
|
67
|
+
targetValue = (scrollState / 52f).coerceIn(
|
|
68
|
+
0f,
|
|
69
|
+
1f
|
|
70
|
+
) * ((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
val animatedHeight by animateFloatAsState(
|
|
74
|
+
targetValue = (1 - (scrollState / 52f).coerceIn(
|
|
75
|
+
0f,
|
|
76
|
+
1f
|
|
77
|
+
)) * (statusBarHeight.value + 94 - (statusBarHeight.value + 52)) + (statusBarHeight.value + 52),
|
|
78
|
+
)
|
|
36
79
|
Box(
|
|
37
|
-
modifier = Modifier.fillMaxWidth()
|
|
80
|
+
modifier = Modifier.fillMaxWidth()
|
|
81
|
+
.height(animatedHeight.dp)
|
|
38
82
|
) {
|
|
39
83
|
Box(
|
|
40
84
|
modifier = Modifier
|
|
41
85
|
.fillMaxWidth()
|
|
42
86
|
.height(154.dp)
|
|
43
|
-
.alpha(
|
|
87
|
+
.alpha(opacityAni)
|
|
44
88
|
.background(
|
|
45
89
|
Brush.linearGradient(
|
|
46
90
|
colors = listOf(
|
|
@@ -70,21 +114,34 @@ fun HeaderExtended(
|
|
|
70
114
|
}
|
|
71
115
|
}
|
|
72
116
|
|
|
117
|
+
Box(
|
|
118
|
+
modifier = Modifier
|
|
119
|
+
.fillMaxWidth()
|
|
120
|
+
.alpha(1f - opacityAni)
|
|
121
|
+
.height(statusBarHeight + 52.dp)
|
|
122
|
+
.background(
|
|
123
|
+
AppTheme.current.colors.background.surface
|
|
124
|
+
)
|
|
125
|
+
.bottomBorder(
|
|
126
|
+
strokeWidth = 1.dp,
|
|
127
|
+
color = AppTheme.current.colors.border.default
|
|
128
|
+
)
|
|
129
|
+
)
|
|
73
130
|
if (inputSearchProps != null && useAnimationSearch) {
|
|
74
131
|
Box(
|
|
75
132
|
modifier = Modifier
|
|
76
133
|
.height(52.dp)
|
|
77
134
|
.offset(
|
|
78
|
-
x =
|
|
135
|
+
x = animatedTranslateX.dp
|
|
79
136
|
)
|
|
80
137
|
.padding(vertical = Spacing.S)
|
|
81
138
|
.align(Alignment.BottomStart)
|
|
82
139
|
) {
|
|
83
140
|
Box(
|
|
84
141
|
modifier = Modifier
|
|
85
|
-
.width(
|
|
142
|
+
.width(animatedWidth.dp)
|
|
86
143
|
.background(
|
|
87
|
-
color =
|
|
144
|
+
color = backgroundSearch,
|
|
88
145
|
shape = RoundedCornerShape(Radius.XL)
|
|
89
146
|
)
|
|
90
147
|
) {
|
|
@@ -98,5 +155,4 @@ fun HeaderExtended(
|
|
|
98
155
|
}
|
|
99
156
|
}
|
|
100
157
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
158
|
+
}
|
|
@@ -79,12 +79,12 @@ object Spacing {
|
|
|
79
79
|
|
|
80
80
|
@Composable
|
|
81
81
|
fun HeaderRight(
|
|
82
|
-
|
|
82
|
+
headerRight: HeaderRightData? = null,
|
|
83
83
|
) {
|
|
84
84
|
Row(
|
|
85
85
|
verticalAlignment = Alignment.CenterVertically,
|
|
86
86
|
) {
|
|
87
|
-
ToolkitHeaderRight(headerRight =
|
|
87
|
+
ToolkitHeaderRight(headerRight = headerRight)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -74,7 +74,7 @@ data class KitConfig(
|
|
|
74
74
|
fun ApplicationContainer(
|
|
75
75
|
theme: Theme = defaultTheme,
|
|
76
76
|
composeApi: ComposeApi? = null,
|
|
77
|
-
statusBarHeight: Dp? =
|
|
77
|
+
statusBarHeight: Dp? = AppStatusBar.current,
|
|
78
78
|
applicationContext: MiniAppContext? = null,
|
|
79
79
|
config: KitConfig? = null,
|
|
80
80
|
content: @Composable () -> Unit,
|
|
@@ -68,6 +68,7 @@ fun Screen(
|
|
|
68
68
|
layoutOffset: Dp = 56.dp,
|
|
69
69
|
inputSearchProps: InputSearchProps? = null,
|
|
70
70
|
useAnimationSearch: Boolean = false,
|
|
71
|
+
headerRightWidth: Dp = 0.dp,
|
|
71
72
|
content: @Composable () -> Unit,
|
|
72
73
|
) {
|
|
73
74
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
@@ -84,7 +85,7 @@ fun Screen(
|
|
|
84
85
|
val bottomPadding = min(indicator, 21.dp)
|
|
85
86
|
|
|
86
87
|
val opacity by animateFloatAsState(
|
|
87
|
-
targetValue = ((scrollState.value /
|
|
88
|
+
targetValue = ((scrollState.value / 52f)).coerceIn(0f, 1f),
|
|
88
89
|
)
|
|
89
90
|
|
|
90
91
|
val headerAnimated =
|
|
@@ -94,15 +95,16 @@ fun Screen(
|
|
|
94
95
|
|
|
95
96
|
Box(
|
|
96
97
|
Modifier.fillMaxSize()
|
|
97
|
-
.background(AppTheme.current.colors.background.
|
|
98
|
+
.background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
98
99
|
) {
|
|
99
100
|
|
|
100
101
|
if (animatedHeader === null) {
|
|
101
102
|
HeaderBackground(
|
|
102
103
|
headerType = headerType,
|
|
103
104
|
scrollState = scrollState.value,
|
|
104
|
-
inputSearchProps
|
|
105
|
-
useAnimationSearch = useAnimationSearch
|
|
105
|
+
inputSearchProps= inputSearchProps,
|
|
106
|
+
useAnimationSearch = useAnimationSearch,
|
|
107
|
+
headerRightWidth = headerRightWidth
|
|
106
108
|
)
|
|
107
109
|
} else {
|
|
108
110
|
Box(
|
|
@@ -114,8 +116,9 @@ fun Screen(
|
|
|
114
116
|
isBack = isBack,
|
|
115
117
|
headerType = headerType,
|
|
116
118
|
scrollState = scrollState.value,
|
|
117
|
-
inputSearchProps
|
|
118
|
-
useAnimationSearch = useAnimationSearch
|
|
119
|
+
inputSearchProps= inputSearchProps,
|
|
120
|
+
useAnimationSearch = useAnimationSearch,
|
|
121
|
+
headerRightWidth = headerRightWidth
|
|
119
122
|
)
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -130,7 +133,7 @@ fun Screen(
|
|
|
130
133
|
animatedHeader = animatedHeader,
|
|
131
134
|
inputSearchProps = inputSearchProps,
|
|
132
135
|
scrollState = scrollState.value,
|
|
133
|
-
useAnimationSearch = useAnimationSearch
|
|
136
|
+
useAnimationSearch = useAnimationSearch,
|
|
134
137
|
)
|
|
135
138
|
|
|
136
139
|
Column(
|
|
@@ -155,18 +158,14 @@ fun Screen(
|
|
|
155
158
|
verticalArrangement = verticalArrangement,
|
|
156
159
|
horizontalAlignment = horizontalAlignment
|
|
157
160
|
) {
|
|
158
|
-
Box
|
|
159
|
-
modifier = Modifier.background(
|
|
160
|
-
backgroundColor ?: AppTheme.current.colors.background.default
|
|
161
|
-
)
|
|
162
|
-
) {
|
|
161
|
+
Box {
|
|
163
162
|
headerAnimated()
|
|
164
163
|
Column {
|
|
165
164
|
if (animatedHeader !== null) {
|
|
166
165
|
Spacer(modifier = Modifier.padding(top = statusBarHeight + 52.dp + layoutOffset))
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
if (useAnimationSearch && inputSearchProps != null) {
|
|
168
|
+
if (useAnimationSearch && headerType == HeaderType.EXTENDED && inputSearchProps != null) {
|
|
170
169
|
Spacer(modifier = Modifier.padding(top = statusBarHeight))
|
|
171
170
|
}
|
|
172
171
|
content()
|
|
@@ -37,7 +37,7 @@ fun Text(
|
|
|
37
37
|
modifier = modifier.setAutomationId(accessibilityId?:text, text),
|
|
38
38
|
text = text,
|
|
39
39
|
color = color ?: AppTheme.current.colors.text.default,
|
|
40
|
-
style = style,
|
|
40
|
+
style = style.copy(fontWeight = null),
|
|
41
41
|
textAlign = textAlign,
|
|
42
42
|
fontSize = fontSize,
|
|
43
43
|
fontFamily = font,
|
package/ios/Image/Image.swift
CHANGED
|
@@ -46,7 +46,8 @@ public struct PopupDisplay: View {
|
|
|
46
46
|
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 1))
|
|
47
47
|
}.foregroundColor(Colors.black20)
|
|
48
48
|
.background(Colors.black01.cornerRadius(15))
|
|
49
|
-
.
|
|
49
|
+
.padding(.trailing, -Spacing.M )
|
|
50
|
+
.padding(.top, -Spacing.M)
|
|
50
51
|
.zIndex(1)
|
|
51
52
|
|
|
52
53
|
VStack {
|
package/local.properties
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
# Location of the SDK. This is only used by Gradle.
|
|
5
5
|
# For customization when using a Version Control System, please read the
|
|
6
6
|
# header note.
|
|
7
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Tue Apr 23 16:40:15 ICT 2024
|
|
8
|
+
sdk.dir=/Users/hung.dao1/Library/Android/sdk
|
package/package.json
CHANGED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.application
|
|
2
|
-
|
|
3
|
-
import androidx.compose.animation.animateColorAsState
|
|
4
|
-
import androidx.compose.animation.core.animateFloatAsState
|
|
5
|
-
import androidx.compose.runtime.Composable
|
|
6
|
-
import androidx.compose.ui.graphics.Color
|
|
7
|
-
import androidx.compose.ui.unit.Dp
|
|
8
|
-
import vn.momo.kits.const.AppTheme
|
|
9
|
-
import vn.momo.kits.const.Colors
|
|
10
|
-
import androidx.compose.runtime.getValue
|
|
11
|
-
|
|
12
|
-
data class HeaderAnimations(
|
|
13
|
-
val opacity: Float,
|
|
14
|
-
val backgroundSearch: Color,
|
|
15
|
-
val translateX: Float,
|
|
16
|
-
val width: Float,
|
|
17
|
-
val height: Float
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
@Composable
|
|
21
|
-
fun useHeaderSearchAnimation(
|
|
22
|
-
scrollState: Int,
|
|
23
|
-
statusBarHeight: Dp,
|
|
24
|
-
leftPosition: Dp,
|
|
25
|
-
searchWidth: Int,
|
|
26
|
-
headerRightWidth: Dp
|
|
27
|
-
): HeaderAnimations {
|
|
28
|
-
val opacityAni by animateFloatAsState(
|
|
29
|
-
targetValue = (1 - (scrollState / 52f)).coerceIn(0f, 1f)
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
val backgroundSearch by animateColorAsState(
|
|
33
|
-
targetValue = animateColor(
|
|
34
|
-
AppTheme.current.colors.background.default,
|
|
35
|
-
Colors.black_01,
|
|
36
|
-
opacityAni
|
|
37
|
-
)
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
val animatedTranslateX by animateFloatAsState(
|
|
41
|
-
targetValue = (scrollState / 52f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
val animatedWidth by animateFloatAsState(
|
|
45
|
-
targetValue = (scrollState / 52f).coerceIn(0f, 1f) *
|
|
46
|
-
((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
val animatedHeight by animateFloatAsState(
|
|
50
|
-
targetValue = (1 - (scrollState / 52f).coerceIn(0f, 1f)) *
|
|
51
|
-
(statusBarHeight.value + 94 - (statusBarHeight.value + 52)) + (statusBarHeight.value + 52)
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
return HeaderAnimations(
|
|
55
|
-
opacity = opacityAni,
|
|
56
|
-
backgroundSearch = backgroundSearch,
|
|
57
|
-
translateX = animatedTranslateX,
|
|
58
|
-
width = animatedWidth,
|
|
59
|
-
height = animatedHeight
|
|
60
|
-
)
|
|
61
|
-
}
|