@momo-kits/native-kits 0.89.7 → 0.89.8
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.
|
@@ -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
|
|
@@ -47,13 +48,15 @@ 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
|
|
@@ -81,9 +84,9 @@ fun Screen(
|
|
|
81
84
|
)
|
|
82
85
|
|
|
83
86
|
Column(
|
|
84
|
-
modifier = if (scrollable) Modifier.weight(1f).padding(bottom =
|
|
87
|
+
modifier = if (scrollable) Modifier.weight(1f).padding(bottom = keyboardSize)
|
|
85
88
|
.verticalScroll(rememberScrollState()) else
|
|
86
|
-
Modifier.padding(bottom =
|
|
89
|
+
Modifier.padding(bottom = keyboardSize),
|
|
87
90
|
verticalArrangement = verticalArrangement,
|
|
88
91
|
horizontalAlignment = horizontalAlignment
|
|
89
92
|
) {
|
|
@@ -91,19 +94,18 @@ fun Screen(
|
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
footer?.let {
|
|
94
|
-
Footer(footer)
|
|
97
|
+
Footer(footer, keyboardSize)
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
@Composable
|
|
101
|
-
fun Footer(footer: @Composable (() -> Unit)? = null) {
|
|
104
|
+
fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp) {
|
|
102
105
|
val indicator = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
103
|
-
val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
104
106
|
Box(
|
|
105
107
|
Modifier
|
|
106
|
-
.offset(y =
|
|
108
|
+
.offset(y = - keyboardSize)
|
|
107
109
|
.padding(bottom = min(indicator, 21.dp))
|
|
108
110
|
.shadow(
|
|
109
111
|
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
|