@momo-kits/native-kits 0.89.33-beta.36 → 0.89.33-beta.37
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.
|
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Box
|
|
|
10
10
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
11
11
|
import androidx.compose.foundation.layout.Row
|
|
12
12
|
import androidx.compose.foundation.layout.Spacer
|
|
13
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
14
13
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
15
14
|
import androidx.compose.foundation.layout.height
|
|
16
15
|
import androidx.compose.foundation.layout.padding
|
|
@@ -67,7 +66,6 @@ data class AnimatedHeader(
|
|
|
67
66
|
@Composable
|
|
68
67
|
fun HeaderBackground(
|
|
69
68
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
70
|
-
headerBanner: String? = null,
|
|
71
69
|
scrollState: Int
|
|
72
70
|
) {
|
|
73
71
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
@@ -75,14 +73,6 @@ fun HeaderBackground(
|
|
|
75
73
|
targetValue = (1 - (scrollState / 200f)).coerceIn(0f, 1f),
|
|
76
74
|
)
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
val backgroundColor = if (scrollState == 0) {
|
|
80
|
-
Color.Transparent
|
|
81
|
-
} else {
|
|
82
|
-
AppTheme.current.colors.background.surface
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
76
|
when (headerType) {
|
|
87
77
|
HeaderType.DEFAULT -> {
|
|
88
78
|
val height = statusBarHeight + 52.dp
|
|
@@ -92,7 +82,6 @@ fun HeaderBackground(
|
|
|
92
82
|
strokeWidth = 1.dp,
|
|
93
83
|
color = AppTheme.current.colors.border.default
|
|
94
84
|
)
|
|
95
|
-
.background(backgroundColor)
|
|
96
85
|
) {
|
|
97
86
|
Box(
|
|
98
87
|
modifier = Modifier
|
|
@@ -112,7 +101,7 @@ fun HeaderBackground(
|
|
|
112
101
|
)
|
|
113
102
|
if (AppTheme.current.assets.headerBackground != null) {
|
|
114
103
|
Image(
|
|
115
|
-
source =
|
|
104
|
+
source = AppTheme.current.assets.headerBackground!!,
|
|
116
105
|
modifier = Modifier.fillMaxWidth().height(height),
|
|
117
106
|
options = Options(
|
|
118
107
|
contentScale = ContentScale.FillWidth
|
|
@@ -124,34 +113,28 @@ fun HeaderBackground(
|
|
|
124
113
|
}
|
|
125
114
|
|
|
126
115
|
HeaderType.EXTENDED -> {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
139
|
-
)
|
|
116
|
+
Box(
|
|
117
|
+
modifier = Modifier.fillMaxWidth().height(154.dp)
|
|
118
|
+
.alpha(opacityAni)
|
|
119
|
+
.background(
|
|
120
|
+
Brush.linearGradient(
|
|
121
|
+
colors = listOf(
|
|
122
|
+
Color(0xFFFDCADE),
|
|
123
|
+
Color(0x00FDCADE)
|
|
124
|
+
),
|
|
125
|
+
start = Offset(0f, 0f),
|
|
126
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
140
127
|
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
contentScale = ContentScale.FillWidth
|
|
152
|
-
)
|
|
153
|
-
)
|
|
154
|
-
}
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
if (AppTheme.current.assets.headerBackground != null) {
|
|
131
|
+
Image(
|
|
132
|
+
source = AppTheme.current.assets.headerBackground!!,
|
|
133
|
+
modifier = Modifier.fillMaxWidth().height(154.dp),
|
|
134
|
+
options = Options(
|
|
135
|
+
contentScale = ContentScale.FillWidth
|
|
136
|
+
)
|
|
137
|
+
)
|
|
155
138
|
}
|
|
156
139
|
}
|
|
157
140
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
package vn.momo.kits.application
|
|
2
2
|
|
|
3
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
4
|
+
import androidx.compose.foundation.layout.asPaddingValues
|
|
5
|
+
import androidx.compose.foundation.layout.systemBars
|
|
3
6
|
import androidx.compose.runtime.Composable
|
|
4
7
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
8
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
@@ -14,10 +17,6 @@ val AppNavigator = staticCompositionLocalOf<Navigator> {
|
|
|
14
17
|
error("no navigator provided!")
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
val PlatformApi = staticCompositionLocalOf<ComposeApi> {
|
|
18
|
-
error("no api provided!")
|
|
19
|
-
}
|
|
20
|
-
|
|
21
20
|
class Navigator {
|
|
22
21
|
fun push(content: @Composable () -> Unit) {
|
|
23
22
|
}
|
|
@@ -50,23 +49,14 @@ class Navigator {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
interface ComposeApi {
|
|
54
|
-
fun request(funcName: String, params: String?): String
|
|
55
|
-
fun request(funcName: String, params: String?, onResponse: ((String) -> Unit)?): String
|
|
56
|
-
fun requestCallback(funcName: String, params: String?, onResponse: ((String) -> Unit)?)
|
|
57
|
-
fun removeCallback(id: String)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
52
|
@Composable
|
|
61
53
|
fun ApplicationContainer(
|
|
62
54
|
theme: Theme = defaultTheme,
|
|
63
|
-
composeApi: ComposeApi,
|
|
64
55
|
content: @Composable () -> Unit,
|
|
65
56
|
) {
|
|
66
57
|
disableOverscroll()
|
|
67
58
|
CompositionLocalProvider(
|
|
68
59
|
AppTheme provides theme,
|
|
69
|
-
PlatformApi provides composeApi,
|
|
70
60
|
AppNavigator provides Navigator(),
|
|
71
61
|
AppStatusBar provides getStatusBarHeight(),
|
|
72
62
|
) {
|
|
@@ -32,8 +32,6 @@ import androidx.compose.ui.unit.Dp
|
|
|
32
32
|
import androidx.compose.ui.unit.dp
|
|
33
33
|
import androidx.compose.ui.unit.min
|
|
34
34
|
import androidx.compose.ui.zIndex
|
|
35
|
-
import kotlinx.serialization.Serializable
|
|
36
|
-
import kotlinx.serialization.json.Json
|
|
37
35
|
import vn.momo.kits.components.InputSearchProps
|
|
38
36
|
import vn.momo.kits.const.AppStatusBar
|
|
39
37
|
import vn.momo.kits.const.AppTheme
|
|
@@ -49,9 +47,6 @@ enum class HeaderType {
|
|
|
49
47
|
NONE
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
@Serializable
|
|
53
|
-
data class ConfigData(val headerBanner: String? = null)
|
|
54
|
-
|
|
55
50
|
@Composable
|
|
56
51
|
fun Screen(
|
|
57
52
|
backgroundColor: Color? = null,
|
|
@@ -84,11 +79,6 @@ fun Screen(
|
|
|
84
79
|
else -> 0.dp
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
val platformApi = PlatformApi.current
|
|
88
|
-
val rawData = platformApi.request("GetConfig", "DESIGN_SYSTEM")
|
|
89
|
-
val json = Json { ignoreUnknownKeys = true }
|
|
90
|
-
val headerBanner = json.decodeFromString<ConfigData>(rawData).headerBanner
|
|
91
|
-
|
|
92
82
|
val indicator = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
93
83
|
val bottomPadding = min(indicator, 21.dp)
|
|
94
84
|
|
|
@@ -105,11 +95,7 @@ fun Screen(
|
|
|
105
95
|
) {
|
|
106
96
|
|
|
107
97
|
if (animatedHeader === null) {
|
|
108
|
-
HeaderBackground(
|
|
109
|
-
headerType = headerType,
|
|
110
|
-
scrollState = scrollState.value,
|
|
111
|
-
headerBanner = headerBanner
|
|
112
|
-
)
|
|
98
|
+
HeaderBackground(headerType = headerType, scrollState = scrollState.value)
|
|
113
99
|
} else {
|
|
114
100
|
Box(
|
|
115
101
|
Modifier.zIndex(2f)
|