@momo-kits/native-kits 0.112.1-beta.9 → 0.112.1-rn76.46
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/build.gradle.kts +9 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +186 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +79 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +75 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +75 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +128 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +30 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +73 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +23 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +68 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +7 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +5 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +41 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +19 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +36 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +26 -30
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{PromotionPopup.kt → PopupPromotion.kt} +11 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +30 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +3 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +50 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +178 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +237 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +127 -159
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +12 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +1 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +1 -1
- package/ios/Application/ApplicationEnvironment.swift +50 -0
- package/ios/Application/Components.swift +238 -0
- package/ios/Application/ComposeApi.swift +22 -0
- package/ios/Application/FloatingButton.swift +148 -0
- package/ios/Application/HeaderRight.swift +263 -0
- package/ios/Application/Screen.swift +193 -0
- package/ios/Badge/BadgeDot.swift +31 -0
- package/ios/Button/Button.swift +1 -2
- package/ios/Checkbox/Checkbox.swift +1 -1
- package/ios/Icon/Icon.swift +1 -3
- package/ios/Image/Image.swift +17 -1
- package/ios/Input/InputSearch.swift +56 -0
- package/ios/Popup/PopupDisplay.swift +99 -42
- package/ios/Popup/PopupPromotion.swift +55 -40
- package/ios/Swipeable/SwipeCell.swift +39 -31
- package/ios/Template/TrustBanner/TrustBanner.swift +75 -144
- package/ios/Typography/Typography.swift +2 -1
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +0 -311
package/compose/build.gradle.kts
CHANGED
|
@@ -41,6 +41,7 @@ kotlin {
|
|
|
41
41
|
implementation(libs.coil.multiplatform.core)
|
|
42
42
|
implementation(libs.coil.multiplatform.network.ktor)
|
|
43
43
|
implementation(libs.jetbrains.serialization.json)
|
|
44
|
+
implementation(libs.kotlinx.datetime)
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
val androidMain by getting {
|
|
@@ -99,3 +100,11 @@ android {
|
|
|
99
100
|
jvmToolchain(17)
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
|
|
104
|
+
compose {
|
|
105
|
+
resources {
|
|
106
|
+
publicResClass = true
|
|
107
|
+
packageOfResClass = "vn.momo.uikits.resources"
|
|
108
|
+
generateResClass = always
|
|
109
|
+
}
|
|
110
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
6
|
+
import androidx.compose.foundation.layout.height
|
|
7
|
+
import androidx.compose.foundation.layout.offset
|
|
8
|
+
import androidx.compose.foundation.layout.padding
|
|
9
|
+
import androidx.compose.foundation.layout.width
|
|
10
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
11
|
+
import androidx.compose.runtime.Composable
|
|
12
|
+
import androidx.compose.ui.Modifier
|
|
13
|
+
import androidx.compose.ui.graphics.Color
|
|
14
|
+
import androidx.compose.ui.unit.dp
|
|
15
|
+
import androidx.compose.ui.zIndex
|
|
16
|
+
import vn.momo.kits.components.InputSearch
|
|
17
|
+
import vn.momo.kits.components.InputSearchProps
|
|
18
|
+
import vn.momo.kits.const.Radius
|
|
19
|
+
import vn.momo.kits.const.Spacing
|
|
20
|
+
|
|
21
|
+
@Composable
|
|
22
|
+
fun AnimationSearchInput(
|
|
23
|
+
animations: HeaderAnimations,
|
|
24
|
+
inputSearchProps: InputSearchProps
|
|
25
|
+
) {
|
|
26
|
+
Box(
|
|
27
|
+
modifier = Modifier
|
|
28
|
+
.fillMaxWidth()
|
|
29
|
+
.offset(
|
|
30
|
+
x = animations.translateX.dp,
|
|
31
|
+
y = animations.translateY.dp
|
|
32
|
+
)
|
|
33
|
+
) {
|
|
34
|
+
Box(
|
|
35
|
+
modifier = Modifier
|
|
36
|
+
.height(HEADER_HEIGHT.dp)
|
|
37
|
+
.padding(vertical = Spacing.S)
|
|
38
|
+
.zIndex(1f)
|
|
39
|
+
) {
|
|
40
|
+
Box(
|
|
41
|
+
modifier = Modifier
|
|
42
|
+
.width(animations.width.dp)
|
|
43
|
+
.background(
|
|
44
|
+
color = animations.backgroundSearch,
|
|
45
|
+
shape = RoundedCornerShape(Radius.XL)
|
|
46
|
+
)
|
|
47
|
+
) {
|
|
48
|
+
InputSearch(
|
|
49
|
+
inputSearchProps = inputSearchProps.copy(
|
|
50
|
+
showButtonText = false,
|
|
51
|
+
backgroundColor = Color.Transparent
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.border
|
|
5
|
+
import androidx.compose.foundation.clickable
|
|
6
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
7
|
+
import androidx.compose.foundation.layout.Box
|
|
8
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
9
|
+
import androidx.compose.foundation.layout.Row
|
|
10
|
+
import androidx.compose.foundation.layout.Spacer
|
|
11
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
12
|
+
import androidx.compose.foundation.layout.height
|
|
13
|
+
import androidx.compose.foundation.layout.padding
|
|
14
|
+
import androidx.compose.foundation.layout.size
|
|
15
|
+
import androidx.compose.foundation.layout.width
|
|
16
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
17
|
+
import androidx.compose.runtime.Composable
|
|
18
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
19
|
+
import androidx.compose.runtime.getValue
|
|
20
|
+
import androidx.compose.runtime.mutableStateOf
|
|
21
|
+
import androidx.compose.runtime.remember
|
|
22
|
+
import androidx.compose.runtime.setValue
|
|
23
|
+
import androidx.compose.runtime.snapshotFlow
|
|
24
|
+
import androidx.compose.ui.Alignment
|
|
25
|
+
import androidx.compose.ui.Modifier
|
|
26
|
+
import androidx.compose.ui.graphics.Color
|
|
27
|
+
import androidx.compose.ui.graphics.graphicsLayer
|
|
28
|
+
import androidx.compose.ui.semantics.semantics
|
|
29
|
+
import androidx.compose.ui.semantics.testTag
|
|
30
|
+
import androidx.compose.ui.unit.Dp
|
|
31
|
+
import androidx.compose.ui.unit.dp
|
|
32
|
+
import androidx.compose.ui.zIndex
|
|
33
|
+
import kotlinx.coroutines.flow.distinctUntilChanged
|
|
34
|
+
import kotlinx.coroutines.flow.map
|
|
35
|
+
import vn.momo.kits.components.Icon
|
|
36
|
+
import vn.momo.kits.components.InputSearch
|
|
37
|
+
import vn.momo.kits.components.InputSearchProps
|
|
38
|
+
import vn.momo.kits.const.AppStatusBar
|
|
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.modifier.setAutomationId
|
|
43
|
+
import vn.momo.kits.platform.getStatusBarHeight
|
|
44
|
+
|
|
45
|
+
@Composable
|
|
46
|
+
fun Header(
|
|
47
|
+
headerType: HeaderType = HeaderType.DEFAULT,
|
|
48
|
+
titlePosition: TitlePosition,
|
|
49
|
+
title: String,
|
|
50
|
+
headerRight: @Composable (() -> Unit)? = null,
|
|
51
|
+
goBack: (() -> Unit)? = null,
|
|
52
|
+
opacity: Float = 1f,
|
|
53
|
+
animatedHeader: AnimatedHeader? = null,
|
|
54
|
+
scrollState: Int = 0,
|
|
55
|
+
inputSearchProps: InputSearchProps? = null,
|
|
56
|
+
headerRightWidth: Dp = 0.dp,
|
|
57
|
+
useAnimationSearch: Boolean = false,
|
|
58
|
+
tintColor: Color? = null
|
|
59
|
+
) {
|
|
60
|
+
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
61
|
+
val tintIconColor = tintColor ?: AppTheme.current.colors.text.default
|
|
62
|
+
val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
|
|
63
|
+
val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
|
|
64
|
+
|
|
65
|
+
var colorFraction by remember { mutableStateOf(0f) }
|
|
66
|
+
|
|
67
|
+
LaunchedEffect(scrollState) {
|
|
68
|
+
snapshotFlow { scrollState }
|
|
69
|
+
.map { (it / 50f).coerceIn(0f, 1f) }
|
|
70
|
+
.distinctUntilChanged()
|
|
71
|
+
.collect { fraction -> colorFraction = fraction }
|
|
72
|
+
}
|
|
73
|
+
val animations = useHeaderSearchAnimation(
|
|
74
|
+
opacityAni = opacity,
|
|
75
|
+
scrollState = scrollState,
|
|
76
|
+
headerRightWidth = headerRightWidth,
|
|
77
|
+
isBack = goBack != null
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
val backgroundSearch = animateColor(
|
|
81
|
+
Colors.black_01,
|
|
82
|
+
AppTheme.current.colors.background.default,
|
|
83
|
+
colorFraction
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
val searchAnimationEnable =
|
|
87
|
+
inputSearchProps != null && useAnimationSearch && headerType == HeaderType.EXTENDED
|
|
88
|
+
|
|
89
|
+
if (headerType != HeaderType.NONE) {
|
|
90
|
+
BoxWithConstraints(
|
|
91
|
+
Modifier.height(statusBarHeight + HEADER_HEIGHT.dp)
|
|
92
|
+
.fillMaxWidth()
|
|
93
|
+
.zIndex(10f),
|
|
94
|
+
contentAlignment = Alignment.BottomCenter
|
|
95
|
+
) {
|
|
96
|
+
Row(
|
|
97
|
+
modifier = Modifier.height(HEADER_HEIGHT.dp)
|
|
98
|
+
.fillMaxWidth()
|
|
99
|
+
.padding(horizontal = Spacing.M),
|
|
100
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
101
|
+
horizontalArrangement = Arrangement.SpaceBetween
|
|
102
|
+
) {
|
|
103
|
+
Box {
|
|
104
|
+
if (goBack != null) {
|
|
105
|
+
Box(
|
|
106
|
+
modifier = Modifier
|
|
107
|
+
.size(28.dp)
|
|
108
|
+
.then(
|
|
109
|
+
Modifier.border(
|
|
110
|
+
0.2.dp,
|
|
111
|
+
borderColor,
|
|
112
|
+
RoundedCornerShape(100)
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
.background(
|
|
116
|
+
backgroundButton,
|
|
117
|
+
RoundedCornerShape(100)
|
|
118
|
+
)
|
|
119
|
+
.clickable(
|
|
120
|
+
onClick = goBack
|
|
121
|
+
)
|
|
122
|
+
.padding(Spacing.XS)
|
|
123
|
+
.setAutomationId("btn_navigation_back"),
|
|
124
|
+
contentAlignment = Alignment.Center
|
|
125
|
+
) {
|
|
126
|
+
Icon(
|
|
127
|
+
source = "arrow-back",
|
|
128
|
+
color = tintIconColor,
|
|
129
|
+
size = 20.dp,
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (useAnimationSearch || inputSearchProps == null) {
|
|
136
|
+
Box(Modifier.graphicsLayer {
|
|
137
|
+
alpha = if (animatedHeader !== null) opacity else 1f
|
|
138
|
+
}) {
|
|
139
|
+
headerRight?.invoke()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Title
|
|
145
|
+
Row(
|
|
146
|
+
modifier = Modifier.height(HEADER_HEIGHT.dp)
|
|
147
|
+
.fillMaxWidth()
|
|
148
|
+
.padding(horizontal = Spacing.M),
|
|
149
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
150
|
+
) {
|
|
151
|
+
if (goBack != null && titlePosition == TitlePosition.LEFT) {
|
|
152
|
+
Spacer(Modifier.width(40.dp))
|
|
153
|
+
}
|
|
154
|
+
if (inputSearchProps != null && !useAnimationSearch) {
|
|
155
|
+
InputSearch(inputSearchProps = inputSearchProps.copy(backgroundColor = backgroundSearch))
|
|
156
|
+
} else {
|
|
157
|
+
Box(
|
|
158
|
+
Modifier.weight(1f).graphicsLayer {
|
|
159
|
+
alpha = if (useAnimationSearch) {
|
|
160
|
+
1f - (opacity)
|
|
161
|
+
} else {
|
|
162
|
+
if (animatedHeader !== null) opacity else 1f
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
contentAlignment = if (titlePosition == TitlePosition.LEFT) Alignment.TopStart else Alignment.Center
|
|
166
|
+
) {
|
|
167
|
+
HeaderTitle(
|
|
168
|
+
title = title,
|
|
169
|
+
color = tintIconColor,
|
|
170
|
+
modifier = Modifier.semantics {
|
|
171
|
+
testTag = "title_navigation_header"
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (searchAnimationEnable) {
|
|
179
|
+
AnimationSearchInput(
|
|
180
|
+
animations = animations,
|
|
181
|
+
inputSearchProps = inputSearchProps!!
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.animateColorAsState
|
|
4
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
5
|
+
import androidx.compose.foundation.layout.Box
|
|
6
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.getValue
|
|
9
|
+
import androidx.compose.ui.Modifier
|
|
10
|
+
import androidx.compose.ui.graphics.Color
|
|
11
|
+
import vn.momo.kits.const.AppStatusBar
|
|
12
|
+
import vn.momo.kits.const.AppTheme
|
|
13
|
+
import vn.momo.kits.platform.getStatusBarHeight
|
|
14
|
+
|
|
15
|
+
enum class TitlePosition {
|
|
16
|
+
LEFT, CENTER,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
data class AnimatedHeader(
|
|
20
|
+
val type: HeaderType = HeaderType.DEFAULT,
|
|
21
|
+
val composable: @Composable (scrollState: Int) -> Unit = {}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
25
|
+
return Color(
|
|
26
|
+
red = start.red + fraction * (stop.red - start.red),
|
|
27
|
+
green = start.green + fraction * (stop.green - start.green),
|
|
28
|
+
blue = start.blue + fraction * (stop.blue - start.blue),
|
|
29
|
+
alpha = start.alpha + fraction * (stop.alpha - start.alpha)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
fun HeaderBackground(
|
|
35
|
+
headerType: HeaderType = HeaderType.DEFAULT,
|
|
36
|
+
scrollState: Int,
|
|
37
|
+
headerTransparent: Boolean = false,
|
|
38
|
+
) {
|
|
39
|
+
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
40
|
+
|
|
41
|
+
val opacityAni by animateFloatAsState(
|
|
42
|
+
targetValue = (1 - (scrollState / HEADER_HEIGHT * 1f)).coerceIn(0f, 1f),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
val backgroundColor by animateColorAsState(
|
|
46
|
+
targetValue = if (headerTransparent) {
|
|
47
|
+
Color.Transparent
|
|
48
|
+
} else {
|
|
49
|
+
animateColor(
|
|
50
|
+
Color.Transparent,
|
|
51
|
+
AppTheme.current.colors.background.surface,
|
|
52
|
+
opacityAni
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
when (headerType) {
|
|
58
|
+
HeaderType.DEFAULT -> {
|
|
59
|
+
HeaderDefault(
|
|
60
|
+
opacityAni = opacityAni,
|
|
61
|
+
statusBarHeight = statusBarHeight,
|
|
62
|
+
backgroundColor = backgroundColor,
|
|
63
|
+
headerTransparent = headerTransparent
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
HeaderType.EXTENDED -> {
|
|
68
|
+
HeaderExtended(
|
|
69
|
+
opacityAni = opacityAni,
|
|
70
|
+
statusBarHeight = statusBarHeight,
|
|
71
|
+
backgroundColor = backgroundColor,
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
else -> {
|
|
76
|
+
Box(modifier = Modifier.fillMaxWidth())
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
6
|
+
import androidx.compose.foundation.layout.height
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.ui.Modifier
|
|
9
|
+
import androidx.compose.ui.draw.alpha
|
|
10
|
+
import androidx.compose.ui.geometry.Offset
|
|
11
|
+
import androidx.compose.ui.graphics.Brush
|
|
12
|
+
import androidx.compose.ui.graphics.Color
|
|
13
|
+
import androidx.compose.ui.layout.ContentScale
|
|
14
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
15
|
+
import androidx.compose.ui.unit.Dp
|
|
16
|
+
import androidx.compose.ui.unit.dp
|
|
17
|
+
import vn.momo.kits.components.Image
|
|
18
|
+
import vn.momo.kits.components.Options
|
|
19
|
+
import vn.momo.kits.const.AppTheme
|
|
20
|
+
import vn.momo.kits.utils.bottomBorder
|
|
21
|
+
|
|
22
|
+
@Composable
|
|
23
|
+
fun HeaderDefault(
|
|
24
|
+
opacityAni: Float,
|
|
25
|
+
statusBarHeight: Dp,
|
|
26
|
+
backgroundColor: Color?,
|
|
27
|
+
headerTransparent: Boolean = false
|
|
28
|
+
) {
|
|
29
|
+
val height = statusBarHeight + HEADER_HEIGHT.dp
|
|
30
|
+
Box(
|
|
31
|
+
modifier = Modifier.fillMaxWidth().height(height)
|
|
32
|
+
.background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
|
|
33
|
+
.bottomBorder(
|
|
34
|
+
strokeWidth = 1.dp,
|
|
35
|
+
color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
|
|
36
|
+
)
|
|
37
|
+
) {
|
|
38
|
+
Box(
|
|
39
|
+
modifier = Modifier
|
|
40
|
+
.height(height)
|
|
41
|
+
.fillMaxWidth()
|
|
42
|
+
.alpha(opacityAni)
|
|
43
|
+
.background(
|
|
44
|
+
if (headerTransparent)
|
|
45
|
+
Brush.linearGradient(
|
|
46
|
+
colors = listOf(
|
|
47
|
+
Color.Transparent,
|
|
48
|
+
Color.Transparent,
|
|
49
|
+
),
|
|
50
|
+
start = Offset(0f, 0f),
|
|
51
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
52
|
+
)
|
|
53
|
+
else
|
|
54
|
+
Brush.linearGradient(
|
|
55
|
+
colors = listOf(
|
|
56
|
+
Color(0xFFFDCADE),
|
|
57
|
+
Color(0x00FDCADE)
|
|
58
|
+
),
|
|
59
|
+
start = Offset(0f, 0f),
|
|
60
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
if (AppTheme.current.assets.headerBackground != null) {
|
|
65
|
+
Image(
|
|
66
|
+
loading = false,
|
|
67
|
+
source = AppTheme.current.assets.headerBackground!!,
|
|
68
|
+
modifier = Modifier.fillMaxWidth().height(height),
|
|
69
|
+
options = Options(
|
|
70
|
+
contentScale = ContentScale.FillWidth
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
6
|
+
import androidx.compose.foundation.layout.height
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.ui.Modifier
|
|
9
|
+
import androidx.compose.ui.draw.alpha
|
|
10
|
+
import androidx.compose.ui.geometry.Offset
|
|
11
|
+
import androidx.compose.ui.graphics.Brush
|
|
12
|
+
import androidx.compose.ui.graphics.Color
|
|
13
|
+
import androidx.compose.ui.layout.ContentScale
|
|
14
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
15
|
+
import androidx.compose.ui.unit.Dp
|
|
16
|
+
import androidx.compose.ui.unit.dp
|
|
17
|
+
import vn.momo.kits.components.Image
|
|
18
|
+
import vn.momo.kits.components.Options
|
|
19
|
+
import vn.momo.kits.const.AppTheme
|
|
20
|
+
import vn.momo.kits.utils.bottomBorder
|
|
21
|
+
|
|
22
|
+
@Composable
|
|
23
|
+
fun HeaderExtended(
|
|
24
|
+
opacityAni: Float,
|
|
25
|
+
statusBarHeight: Dp,
|
|
26
|
+
backgroundColor: Color
|
|
27
|
+
) {
|
|
28
|
+
Box(
|
|
29
|
+
modifier = Modifier
|
|
30
|
+
.fillMaxWidth()
|
|
31
|
+
.height(154.dp)
|
|
32
|
+
.alpha(opacityAni)
|
|
33
|
+
.background(
|
|
34
|
+
Brush.linearGradient(
|
|
35
|
+
colors = listOf(
|
|
36
|
+
Color(0xFFFDCADE),
|
|
37
|
+
Color(0x00FDCADE)
|
|
38
|
+
),
|
|
39
|
+
start = Offset(0f, 0f),
|
|
40
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
) {
|
|
44
|
+
if (AppTheme.current.assets.headerBackground != null) {
|
|
45
|
+
Box(
|
|
46
|
+
modifier = Modifier
|
|
47
|
+
.fillMaxWidth()
|
|
48
|
+
.background(backgroundColor)
|
|
49
|
+
) {
|
|
50
|
+
Image(
|
|
51
|
+
loading = false,
|
|
52
|
+
source = AppTheme.current.assets.headerBackground!!,
|
|
53
|
+
modifier = Modifier.fillMaxWidth().height(154.dp),
|
|
54
|
+
options = Options(
|
|
55
|
+
contentScale = ContentScale.FillWidth
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Box(
|
|
63
|
+
modifier = Modifier
|
|
64
|
+
.fillMaxWidth()
|
|
65
|
+
.alpha(1f - opacityAni)
|
|
66
|
+
.height(statusBarHeight + HEADER_HEIGHT.dp)
|
|
67
|
+
.background(
|
|
68
|
+
AppTheme.current.colors.background.surface
|
|
69
|
+
)
|
|
70
|
+
.bottomBorder(
|
|
71
|
+
strokeWidth = 1.dp,
|
|
72
|
+
color = AppTheme.current.colors.border.default
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
}
|