@momo-kits/native-kits 0.89.7 → 0.89.9
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.
|
@@ -88,7 +88,6 @@ fun Header(
|
|
|
88
88
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
89
89
|
titlePosition: TitlePosition,
|
|
90
90
|
title: String,
|
|
91
|
-
backgroundColor: Color,
|
|
92
91
|
isBack: Boolean,
|
|
93
92
|
headerRight: @Composable (() -> Unit)? = null,
|
|
94
93
|
goBack: (() -> Unit) = { },
|
|
@@ -108,7 +107,6 @@ fun Header(
|
|
|
108
107
|
if (headerType != HeaderType.NONE) {
|
|
109
108
|
BoxWithConstraints(
|
|
110
109
|
Modifier.height(statusBarHeight + 52.dp)
|
|
111
|
-
.background(backgroundColor)
|
|
112
110
|
.fillMaxWidth()
|
|
113
111
|
.bottomBorder(
|
|
114
112
|
strokeWidth = if (headerType == HeaderType.SURFACE) 2.dp else 0.dp,
|
|
@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
|
|
|
21
21
|
import androidx.compose.ui.graphics.Color
|
|
22
22
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
23
23
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
24
|
+
import androidx.compose.ui.unit.Dp
|
|
24
25
|
import androidx.compose.ui.unit.dp
|
|
25
26
|
import androidx.compose.ui.unit.min
|
|
26
27
|
import vn.momo.kits.const.AppTheme
|
|
@@ -37,7 +38,7 @@ enum class HeaderType {
|
|
|
37
38
|
|
|
38
39
|
@Composable
|
|
39
40
|
fun Screen(
|
|
40
|
-
backgroundColor: Color =
|
|
41
|
+
backgroundColor: Color? = null,
|
|
41
42
|
headerBackground: String? = null,
|
|
42
43
|
isBack: Boolean = true,
|
|
43
44
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -47,20 +48,22 @@ fun Screen(
|
|
|
47
48
|
titlePosition: TitlePosition = TitlePosition.LEFT,
|
|
48
49
|
goBack: (() -> Unit) = { },
|
|
49
50
|
scrollable: Boolean = true,
|
|
51
|
+
useAvoidKeyboard: Boolean = true,
|
|
50
52
|
footer: @Composable (() -> Unit)? = null,
|
|
51
53
|
headerRight: @Composable (() -> Unit)? = null,
|
|
52
54
|
content: @Composable () -> Unit,
|
|
53
55
|
) {
|
|
54
56
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
55
57
|
val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
56
|
-
val
|
|
58
|
+
val keyboardSize = when {
|
|
59
|
+
!useAvoidKeyboard -> 0.dp
|
|
57
60
|
keyboardHeight > 100.dp && footer == null -> keyboardHeight
|
|
58
61
|
keyboardHeight > 100.dp && footer != null -> keyboardHeight - 21.dp
|
|
59
62
|
else -> 0.dp
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
Box(
|
|
63
|
-
Modifier.fillMaxSize().background(AppTheme.current.colors.background.default)
|
|
66
|
+
Modifier.fillMaxSize().background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
64
67
|
) {
|
|
65
68
|
HeaderImage(headerType, headerBackground ?: AppTheme.current.assets.headerBackground)
|
|
66
69
|
Column(
|
|
@@ -74,16 +77,15 @@ fun Screen(
|
|
|
74
77
|
headerType = headerType,
|
|
75
78
|
title = title,
|
|
76
79
|
titlePosition = titlePosition,
|
|
77
|
-
backgroundColor = backgroundColor,
|
|
78
80
|
headerRight = headerRight,
|
|
79
81
|
isBack = isBack,
|
|
80
82
|
goBack = goBack,
|
|
81
83
|
)
|
|
82
84
|
|
|
83
85
|
Column(
|
|
84
|
-
modifier = if (scrollable) Modifier.weight(1f).padding(bottom =
|
|
86
|
+
modifier = if (scrollable) Modifier.weight(1f).padding(bottom = keyboardSize)
|
|
85
87
|
.verticalScroll(rememberScrollState()) else
|
|
86
|
-
Modifier.padding(bottom =
|
|
88
|
+
Modifier.padding(bottom = keyboardSize),
|
|
87
89
|
verticalArrangement = verticalArrangement,
|
|
88
90
|
horizontalAlignment = horizontalAlignment
|
|
89
91
|
) {
|
|
@@ -91,19 +93,18 @@ fun Screen(
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
footer?.let {
|
|
94
|
-
Footer(footer)
|
|
96
|
+
Footer(footer, keyboardSize)
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
@Composable
|
|
101
|
-
fun Footer(footer: @Composable (() -> Unit)? = null) {
|
|
103
|
+
fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp) {
|
|
102
104
|
val indicator = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
103
|
-
val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
104
105
|
Box(
|
|
105
106
|
Modifier
|
|
106
|
-
.offset(y =
|
|
107
|
+
.offset(y = - keyboardSize)
|
|
107
108
|
.padding(bottom = min(indicator, 21.dp))
|
|
108
109
|
.shadow(
|
|
109
110
|
Colors.black_20.copy(alpha = 0.1f),
|
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Thu May 16 11:34:53 ICT 2024
|
|
8
|
+
sdk.dir=/Users/wem/Library/Android/sdk
|