@momo-kits/native-kits 0.113.2-beta.2 → 0.113.2-beta.20
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/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +9 -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 +41 -9
- 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 +9 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +22 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -1
- package/ios/Button/Button.swift +1 -2
- package/ios/Image/Image.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +32 -18
- package/ios/Typography/Typography.swift +2 -1
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -156,7 +142,7 @@ fun Header(
|
|
|
156
142
|
} else {
|
|
157
143
|
Box(
|
|
158
144
|
Modifier.weight(1f).graphicsLayer {
|
|
159
|
-
alpha = if (useAnimationSearch
|
|
145
|
+
alpha = if (useAnimationSearch) {
|
|
160
146
|
1f - (opacity ?: 1f)
|
|
161
147
|
} else {
|
|
162
148
|
if (animatedHeader !== null) opacity ?: 1f else 1f
|
|
@@ -164,6 +150,7 @@ fun Header(
|
|
|
164
150
|
},
|
|
165
151
|
contentAlignment = if (titlePosition == TitlePosition.LEFT) Alignment.TopStart else Alignment.Center
|
|
166
152
|
) {
|
|
153
|
+
|
|
167
154
|
HeaderTitle(
|
|
168
155
|
title = title,
|
|
169
156
|
color = tintIconColor,
|
|
@@ -176,14 +163,4 @@ fun Header(
|
|
|
176
163
|
}
|
|
177
164
|
}
|
|
178
165
|
}
|
|
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
|
-
}
|
|
166
|
+
}
|
|
@@ -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,47 @@ 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
|
|
28
35
|
|
|
29
36
|
@Composable
|
|
30
37
|
fun HeaderExtended(
|
|
31
|
-
|
|
32
|
-
inputSearchProps: InputSearchProps
|
|
33
|
-
useAnimationSearch: Boolean =
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
opacityAni: Float,
|
|
39
|
+
inputSearchProps: InputSearchProps?,
|
|
40
|
+
useAnimationSearch: Boolean = true,
|
|
41
|
+
scrollState: Int,
|
|
42
|
+
headerRightWidth: Dp,
|
|
43
|
+
isBack: Boolean,
|
|
44
|
+
statusBarHeight: Dp,
|
|
45
|
+
backgroundColor: Color
|
|
46
|
+
) {
|
|
47
|
+
val animations = useHeaderSearchAnimation(
|
|
48
|
+
opacityAni = opacityAni,
|
|
49
|
+
scrollState = scrollState,
|
|
50
|
+
headerRightWidth = headerRightWidth,
|
|
51
|
+
statusBarHeight = statusBarHeight,
|
|
52
|
+
isBack = isBack
|
|
53
|
+
)
|
|
54
|
+
|
|
36
55
|
Box(
|
|
37
|
-
modifier = Modifier.fillMaxWidth()
|
|
56
|
+
modifier = Modifier.fillMaxWidth()
|
|
57
|
+
.height(animations.height.dp)
|
|
38
58
|
) {
|
|
39
59
|
Box(
|
|
40
60
|
modifier = Modifier
|
|
41
61
|
.fillMaxWidth()
|
|
42
62
|
.height(154.dp)
|
|
43
|
-
.alpha(
|
|
63
|
+
.alpha(opacityAni)
|
|
44
64
|
.background(
|
|
45
65
|
Brush.linearGradient(
|
|
46
66
|
colors = listOf(
|
|
@@ -70,6 +90,19 @@ fun HeaderExtended(
|
|
|
70
90
|
}
|
|
71
91
|
}
|
|
72
92
|
|
|
93
|
+
Box(
|
|
94
|
+
modifier = Modifier
|
|
95
|
+
.fillMaxWidth()
|
|
96
|
+
.alpha(1f - opacityAni)
|
|
97
|
+
.height(statusBarHeight + 52.dp)
|
|
98
|
+
.background(
|
|
99
|
+
AppTheme.current.colors.background.surface
|
|
100
|
+
)
|
|
101
|
+
.bottomBorder(
|
|
102
|
+
strokeWidth = 1.dp,
|
|
103
|
+
color = AppTheme.current.colors.border.default
|
|
104
|
+
)
|
|
105
|
+
)
|
|
73
106
|
if (inputSearchProps != null && useAnimationSearch) {
|
|
74
107
|
Box(
|
|
75
108
|
modifier = Modifier
|
|
@@ -98,5 +131,4 @@ fun HeaderExtended(
|
|
|
98
131
|
}
|
|
99
132
|
}
|
|
100
133
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
134
|
+
}
|
|
@@ -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,7 +95,7 @@ fun Screen(
|
|
|
94
95
|
|
|
95
96
|
Box(
|
|
96
97
|
Modifier.fillMaxSize()
|
|
97
|
-
.background(backgroundColor ?: AppTheme.current.colors.background.
|
|
98
|
+
.background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
98
99
|
) {
|
|
99
100
|
|
|
100
101
|
if (animatedHeader === null) {
|
|
@@ -102,7 +103,8 @@ fun Screen(
|
|
|
102
103
|
headerType = headerType,
|
|
103
104
|
scrollState = scrollState.value,
|
|
104
105
|
inputSearchProps= inputSearchProps,
|
|
105
|
-
useAnimationSearch = useAnimationSearch
|
|
106
|
+
useAnimationSearch = useAnimationSearch,
|
|
107
|
+
headerRightWidth = headerRightWidth
|
|
106
108
|
)
|
|
107
109
|
} else {
|
|
108
110
|
Box(
|
|
@@ -115,7 +117,8 @@ fun Screen(
|
|
|
115
117
|
headerType = headerType,
|
|
116
118
|
scrollState = scrollState.value,
|
|
117
119
|
inputSearchProps= inputSearchProps,
|
|
118
|
-
useAnimationSearch = useAnimationSearch
|
|
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(
|
|
@@ -162,7 +165,7 @@ fun Screen(
|
|
|
162
165
|
Spacer(modifier = Modifier.padding(top = statusBarHeight + 52.dp + layoutOffset))
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
if (useAnimationSearch && inputSearchProps != null) {
|
|
168
|
+
if (useAnimationSearch && inputSearchProps != null && headerType == HeaderType.EXTENDED) {
|
|
166
169
|
Spacer(modifier = Modifier.padding(top = statusBarHeight))
|
|
167
170
|
}
|
|
168
171
|
content()
|
|
@@ -3,11 +3,13 @@ package vn.momo.kits.application
|
|
|
3
3
|
import androidx.compose.animation.animateColorAsState
|
|
4
4
|
import androidx.compose.animation.core.animateFloatAsState
|
|
5
5
|
import androidx.compose.runtime.Composable
|
|
6
|
+
import androidx.compose.runtime.getValue
|
|
6
7
|
import androidx.compose.ui.graphics.Color
|
|
7
8
|
import androidx.compose.ui.unit.Dp
|
|
9
|
+
import androidx.compose.ui.unit.dp
|
|
8
10
|
import vn.momo.kits.const.AppTheme
|
|
9
11
|
import vn.momo.kits.const.Colors
|
|
10
|
-
import
|
|
12
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
11
13
|
|
|
12
14
|
data class HeaderAnimations(
|
|
13
15
|
val opacity: Float,
|
|
@@ -17,40 +19,46 @@ data class HeaderAnimations(
|
|
|
17
19
|
val height: Float
|
|
18
20
|
)
|
|
19
21
|
|
|
22
|
+
private const val SCREEN_PADDING = 12
|
|
23
|
+
private const val BACK_WIDTH = 28
|
|
24
|
+
|
|
20
25
|
@Composable
|
|
21
26
|
fun useHeaderSearchAnimation(
|
|
27
|
+
opacityAni: Float,
|
|
22
28
|
scrollState: Int,
|
|
29
|
+
headerRightWidth: Dp,
|
|
23
30
|
statusBarHeight: Dp,
|
|
24
|
-
|
|
25
|
-
searchWidth: Int,
|
|
26
|
-
headerRightWidth: Dp
|
|
31
|
+
isBack: Boolean
|
|
27
32
|
): HeaderAnimations {
|
|
28
|
-
val
|
|
29
|
-
|
|
30
|
-
)
|
|
33
|
+
val screenWidth = getScreenDimensions().width
|
|
34
|
+
val leftPosition = if (isBack) (BACK_WIDTH + 20).dp else 20.dp
|
|
35
|
+
val searchWidth = screenWidth - (SCREEN_PADDING * 2)
|
|
31
36
|
|
|
32
37
|
val backgroundSearch by animateColorAsState(
|
|
33
38
|
targetValue = animateColor(
|
|
34
39
|
AppTheme.current.colors.background.default,
|
|
35
40
|
Colors.black_01,
|
|
36
41
|
opacityAni
|
|
37
|
-
)
|
|
42
|
+
),
|
|
38
43
|
)
|
|
39
44
|
|
|
40
45
|
val animatedTranslateX by animateFloatAsState(
|
|
41
|
-
targetValue = (scrollState / 52f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12
|
|
46
|
+
targetValue = (scrollState / 52f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12,
|
|
42
47
|
)
|
|
43
48
|
|
|
44
49
|
val animatedWidth by animateFloatAsState(
|
|
45
|
-
targetValue = (scrollState / 52f).coerceIn(
|
|
46
|
-
|
|
50
|
+
targetValue = (scrollState / 52f).coerceIn(
|
|
51
|
+
0f,
|
|
52
|
+
1f
|
|
53
|
+
) * ((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth,
|
|
47
54
|
)
|
|
48
55
|
|
|
49
56
|
val animatedHeight by animateFloatAsState(
|
|
50
|
-
targetValue = (1 - (scrollState / 52f).coerceIn(
|
|
51
|
-
|
|
57
|
+
targetValue = (1 - (scrollState / 52f).coerceIn(
|
|
58
|
+
0f,
|
|
59
|
+
1f
|
|
60
|
+
)) * (statusBarHeight.value + 94 - (statusBarHeight.value + 52)) + (statusBarHeight.value + 52),
|
|
52
61
|
)
|
|
53
|
-
|
|
54
62
|
return HeaderAnimations(
|
|
55
63
|
opacity = opacityAni,
|
|
56
64
|
backgroundSearch = backgroundSearch,
|
|
@@ -115,7 +115,7 @@ fun PopupNotify(
|
|
|
115
115
|
)
|
|
116
116
|
|
|
117
117
|
Column(modifier = Modifier.padding(Spacing.XL)) {
|
|
118
|
-
Text(style = Typography.titleXs, maxLines =
|
|
118
|
+
Text(style = Typography.titleXs, maxLines = 2, text = title)
|
|
119
119
|
content(Modifier.padding(top = Spacing.S))
|
|
120
120
|
if (error.isNotEmpty()) {
|
|
121
121
|
Text(
|
|
@@ -140,8 +140,8 @@ fun PopupNotify(
|
|
|
140
140
|
|
|
141
141
|
Box(
|
|
142
142
|
Modifier
|
|
143
|
-
.width(
|
|
144
|
-
.height(
|
|
143
|
+
.width(22.dp)
|
|
144
|
+
.height(22.dp)
|
|
145
145
|
.offset(x = Spacing.S, y = -Spacing.S)
|
|
146
146
|
.background(
|
|
147
147
|
color = AppTheme.current.colors.text.default,
|
|
@@ -163,7 +163,7 @@ fun PopupNotify(
|
|
|
163
163
|
Icon(
|
|
164
164
|
source = "navigation_close",
|
|
165
165
|
color = AppTheme.current.colors.background.surface,
|
|
166
|
-
size =
|
|
166
|
+
size = 16.dp,
|
|
167
167
|
modifier = Modifier.semantics {
|
|
168
168
|
testTag = "ic_popup_close"
|
|
169
169
|
}
|
|
@@ -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/Button/Button.swift
CHANGED
|
@@ -98,9 +98,8 @@ private extension View {
|
|
|
98
98
|
case .secondary:
|
|
99
99
|
return AnyView(self
|
|
100
100
|
.background(Colors.card)
|
|
101
|
-
.foregroundColor(Colors.
|
|
101
|
+
.foregroundColor(Colors.primary)
|
|
102
102
|
.cornerRadius(8)
|
|
103
|
-
.overlay(RoundedRectangle(cornerRadius: Radius.S).stroke(Colors.black06, lineWidth: 1))
|
|
104
103
|
.padding(2)
|
|
105
104
|
)
|
|
106
105
|
case .outline:
|
package/ios/Image/Image.swift
CHANGED
|
@@ -42,25 +42,35 @@ public struct PopupDisplay: View {
|
|
|
42
42
|
SwiftUI.Button(action: onPressClose) {
|
|
43
43
|
Image(systemName: "xmark.circle.fill")
|
|
44
44
|
.resizable()
|
|
45
|
-
.frame(width:
|
|
45
|
+
.frame(width: 22, height: 22)
|
|
46
|
+
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 1))
|
|
46
47
|
}.foregroundColor(Colors.black20)
|
|
47
|
-
.background(Colors.black01.cornerRadius(
|
|
48
|
-
.
|
|
48
|
+
.background(Colors.black01.cornerRadius(15))
|
|
49
|
+
.padding(.trailing, -Spacing.M )
|
|
50
|
+
.padding(.top, -Spacing.M)
|
|
49
51
|
.zIndex(1)
|
|
50
52
|
|
|
51
53
|
VStack {
|
|
54
|
+
if(!url.isEmpty) {
|
|
52
55
|
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
53
56
|
.resizable()
|
|
57
|
+
.placeholder {
|
|
58
|
+
Rectangle()
|
|
59
|
+
.fill(Color.gray.opacity(0.3))
|
|
60
|
+
.frame(maxWidth: .infinity, maxHeight: 184)
|
|
61
|
+
}
|
|
54
62
|
.scaledToFill()
|
|
55
|
-
.frame(maxWidth: .infinity
|
|
63
|
+
.frame(maxWidth: .infinity)
|
|
56
64
|
.clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .topRight]))
|
|
57
|
-
|
|
65
|
+
.aspectRatio(2, contentMode: .fit)
|
|
66
|
+
}
|
|
58
67
|
VStack(alignment: .leading) {
|
|
59
68
|
Text(title)
|
|
60
69
|
.foregroundColor(.black)
|
|
61
|
-
.font(.
|
|
62
|
-
.padding(.top,
|
|
63
|
-
.padding(.bottom,
|
|
70
|
+
.font(.header_default_semibold)
|
|
71
|
+
.padding(.top, 16)
|
|
72
|
+
.padding(.bottom, 8)
|
|
73
|
+
.lineLimit(2)
|
|
64
74
|
|
|
65
75
|
Text(description)
|
|
66
76
|
.foregroundColor(.black)
|
|
@@ -68,7 +78,9 @@ public struct PopupDisplay: View {
|
|
|
68
78
|
.opacity(0.6)
|
|
69
79
|
.multilineTextAlignment(.leading)
|
|
70
80
|
.padding(.bottom, 20)
|
|
71
|
-
}
|
|
81
|
+
}
|
|
82
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
83
|
+
.padding(.horizontal, 24)
|
|
72
84
|
|
|
73
85
|
if buttonDirection == .row {
|
|
74
86
|
if buttonType == .text {
|
|
@@ -87,10 +99,8 @@ public struct PopupDisplay: View {
|
|
|
87
99
|
}.clipped()
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
|
-
.background(Color.white.cornerRadius(
|
|
91
|
-
.
|
|
92
|
-
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
93
|
-
.padding(.horizontal, 40)
|
|
102
|
+
.background(Color.white.cornerRadius(15))
|
|
103
|
+
.padding(.horizontal, 24)
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
// MARK: Internal
|
|
@@ -106,7 +116,7 @@ public struct PopupDisplay: View {
|
|
|
106
116
|
var onClose: () -> Void
|
|
107
117
|
var actionButtonTitle: String
|
|
108
118
|
var closeButtonTitle: String
|
|
109
|
-
|
|
119
|
+
|
|
110
120
|
var RowTextButtons: some View {
|
|
111
121
|
HStack {
|
|
112
122
|
SwiftUI.Button(action: onPressCloseButton) {
|
|
@@ -143,8 +153,8 @@ public struct PopupDisplay: View {
|
|
|
143
153
|
|
|
144
154
|
var RowButtons: some View {
|
|
145
155
|
HStack {
|
|
146
|
-
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
|
|
147
|
-
Button(title: actionButtonTitle, action: onPressAction)
|
|
156
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium)
|
|
157
|
+
Button(title: actionButtonTitle, action: onPressAction, size: .medium)
|
|
148
158
|
}
|
|
149
159
|
.frame(maxWidth: .infinity, alignment: .center)
|
|
150
160
|
.padding(.horizontal, 24)
|
|
@@ -153,8 +163,12 @@ public struct PopupDisplay: View {
|
|
|
153
163
|
|
|
154
164
|
var ColumnButtons: some View {
|
|
155
165
|
VStack(alignment: .trailing) {
|
|
156
|
-
Button(
|
|
157
|
-
|
|
166
|
+
Button(
|
|
167
|
+
title: actionButtonTitle,
|
|
168
|
+
action: onPressAction,
|
|
169
|
+
size: .medium
|
|
170
|
+
)
|
|
171
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium)
|
|
158
172
|
}
|
|
159
173
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
160
174
|
.padding(.horizontal, 24)
|
|
@@ -2,13 +2,14 @@ import SwiftUI
|
|
|
2
2
|
|
|
3
3
|
public extension Font {
|
|
4
4
|
static func appFont(size: CGFloat) -> Font {
|
|
5
|
-
return Font.
|
|
5
|
+
return Font.system(size: size)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// New supported typography styles
|
|
9
9
|
static let headline_default_bold = appFont(size: 24).weight(.bold)
|
|
10
10
|
static let header_m_bold = appFont(size: 18).weight(.bold)
|
|
11
11
|
static let header_default_bold = appFont(size: 16).weight(.bold)
|
|
12
|
+
static let header_default_semibold = appFont(size: 16).weight(.semibold)
|
|
12
13
|
static let header_s_semibold = appFont(size: 14).weight(.semibold)
|
|
13
14
|
static let header_xs_semibold = appFont(size: 12).weight(.semibold)
|
|
14
15
|
static let body_default_regular = appFont(size: 14).weight(.regular)
|
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
|