@momo-kits/native-kits 0.300.4 → 0.300.5-debug
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/build.gradle.kts +13 -0
- package/compose/build.gradle.kts +197 -0
- package/compose/build.gradle.kts.backup +197 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +153 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +65 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +189 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +361 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +236 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +287 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +404 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +732 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +377 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +455 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +413 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +62 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +34 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
- package/gradle/libs.versions.toml +68 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/README.md +120 -0
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.bottomtab
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.Canvas
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.height
|
|
6
|
+
import androidx.compose.foundation.layout.offset
|
|
7
|
+
import androidx.compose.foundation.layout.width
|
|
8
|
+
import androidx.compose.runtime.Composable
|
|
9
|
+
import androidx.compose.ui.Alignment
|
|
10
|
+
import androidx.compose.ui.Modifier
|
|
11
|
+
import androidx.compose.ui.graphics.Path
|
|
12
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
13
|
+
import androidx.compose.ui.unit.Dp
|
|
14
|
+
import androidx.compose.ui.unit.IntOffset
|
|
15
|
+
import androidx.compose.ui.unit.dp
|
|
16
|
+
import androidx.compose.ui.zIndex
|
|
17
|
+
import vn.momo.kits.const.AppTheme
|
|
18
|
+
|
|
19
|
+
@Composable
|
|
20
|
+
internal fun CurvedContainer(
|
|
21
|
+
circleSize: Dp = 48.dp,
|
|
22
|
+
tabBarItemIconSize: Dp = 28.dp,
|
|
23
|
+
circleOverSize: Dp = 2.dp,
|
|
24
|
+
width: Dp = 71.dp,
|
|
25
|
+
height: Dp = 16.dp
|
|
26
|
+
) {
|
|
27
|
+
val theme = AppTheme.current
|
|
28
|
+
val density = LocalDensity.current
|
|
29
|
+
val widthPx = with(density) { width.toPx()}
|
|
30
|
+
|
|
31
|
+
val circleSizePx = with(density) { circleSize.toPx() }
|
|
32
|
+
val tabBarItemIconSizePx = with(density) { tabBarItemIconSize.toPx() }
|
|
33
|
+
val circleOverSizePx = with(density) { circleOverSize.toPx() }
|
|
34
|
+
|
|
35
|
+
val circlePositionTop = circleSizePx - tabBarItemIconSizePx - 10f
|
|
36
|
+
val circleOverTop = circlePositionTop + circleOverSizePx
|
|
37
|
+
val circleR = circleSizePx / 2
|
|
38
|
+
val circleOverR = circleR + circleOverSizePx
|
|
39
|
+
|
|
40
|
+
val centerX = widthPx / 2
|
|
41
|
+
|
|
42
|
+
val curvedPath = getPath(
|
|
43
|
+
circleOverTop = circleOverTop,
|
|
44
|
+
centerX = centerX,
|
|
45
|
+
circleOverR = circleOverR,
|
|
46
|
+
widthPx = widthPx
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
Box(
|
|
50
|
+
contentAlignment = Alignment.BottomCenter
|
|
51
|
+
){
|
|
52
|
+
Canvas(
|
|
53
|
+
modifier = Modifier
|
|
54
|
+
.width(width)
|
|
55
|
+
.height(height)
|
|
56
|
+
.offset{ IntOffset(x = 0, y = 24) }
|
|
57
|
+
.zIndex(-1f)
|
|
58
|
+
) {
|
|
59
|
+
drawPath(path = curvedPath, color = theme.colors.background.surface)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private fun getPath(circleOverTop: Float, centerX: Float, circleOverR: Float, widthPx: Float): Path{
|
|
65
|
+
return Path().apply {
|
|
66
|
+
moveTo(0f, circleOverTop)
|
|
67
|
+
lineTo(centerX - circleOverR - 40f, circleOverTop)
|
|
68
|
+
|
|
69
|
+
cubicTo(
|
|
70
|
+
centerX - circleOverR, circleOverTop,
|
|
71
|
+
centerX - circleOverR, 0f,
|
|
72
|
+
centerX, 0f
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
cubicTo(
|
|
76
|
+
centerX + circleOverR, 0f,
|
|
77
|
+
centerX + circleOverR, circleOverTop,
|
|
78
|
+
centerX + circleOverR + 40f, circleOverTop
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
lineTo(widthPx, circleOverTop)
|
|
82
|
+
lineTo(widthPx, 60f)
|
|
83
|
+
lineTo(0f, 60f)
|
|
84
|
+
close()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.bottomtab
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.Stable
|
|
5
|
+
import androidx.compose.runtime.compositionLocalOf
|
|
6
|
+
import androidx.compose.runtime.getValue
|
|
7
|
+
import androidx.compose.runtime.mutableStateOf
|
|
8
|
+
import androidx.compose.runtime.remember
|
|
9
|
+
import androidx.compose.runtime.setValue
|
|
10
|
+
import androidx.compose.ui.unit.Dp
|
|
11
|
+
import vn.momo.kits.const.Spacing
|
|
12
|
+
import vn.momo.kits.layout.DuoMetrics
|
|
13
|
+
import vn.momo.kits.layout.ScreenLayout
|
|
14
|
+
|
|
15
|
+
// iPhone Duo: which side bar bar starts compressed when the strip cannot hold both whole.
|
|
16
|
+
enum class DuoBarCompressionBehavior { TOOLBAR, TAB_BAR }
|
|
17
|
+
|
|
18
|
+
private enum class DuoBar { TOOLBAR, TAB_BAR }
|
|
19
|
+
|
|
20
|
+
@Stable
|
|
21
|
+
internal class DuoBarCompression(
|
|
22
|
+
val toolbarCompressed: Boolean = false,
|
|
23
|
+
val tabBarCompressed: Boolean = false,
|
|
24
|
+
// the open rail needs the toolbar button slot too: only Back stays
|
|
25
|
+
val toolbarHidden: Boolean = false,
|
|
26
|
+
val expandToolbar: () -> Unit = {},
|
|
27
|
+
val expandTabBar: () -> Unit = {},
|
|
28
|
+
// a rail opened from the compressed state closes once a tab is picked
|
|
29
|
+
val onTabSelected: () -> Unit = {},
|
|
30
|
+
// side bar columns report their full height so the tab bar knows what is left
|
|
31
|
+
val setToolbarHeight: (Dp) -> Unit = {},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
internal val LocalDuoBarCompression = compositionLocalOf { DuoBarCompression() }
|
|
35
|
+
|
|
36
|
+
// space kept between the top and the bottom groups (HIG Vertical controls)
|
|
37
|
+
internal val DUO_GROUP_GAP = Spacing.M
|
|
38
|
+
// Back, then the right toolkit: help + home capsule
|
|
39
|
+
private val DEFAULT_TOOLBAR_HEIGHT = DuoMetrics.controlSize + Spacing.M + DuoMetrics.itemPitch * 2
|
|
40
|
+
// Back, then the single button the toolbar folds into
|
|
41
|
+
private val COMPRESSED_TOOLBAR_HEIGHT = DuoMetrics.controlSize * 2 + Spacing.M
|
|
42
|
+
|
|
43
|
+
// Port of RN DuoBarCompression (HIG, Designing for iPhone Duo: Vertical controls):
|
|
44
|
+
// - both fit: both stay whole
|
|
45
|
+
// - one fits whole beside the other compressed: one is compressed, tapping it swaps them
|
|
46
|
+
// - otherwise both rest compressed; tapping one opens it for a moment (the rail closes
|
|
47
|
+
// again once a tab is picked)
|
|
48
|
+
@Composable
|
|
49
|
+
internal fun rememberDuoBarCompression(
|
|
50
|
+
behavior: DuoBarCompressionBehavior,
|
|
51
|
+
tabCount: Int,
|
|
52
|
+
hasQr: Boolean,
|
|
53
|
+
layout: ScreenLayout,
|
|
54
|
+
): DuoBarCompression {
|
|
55
|
+
var toolbarHeight by remember { mutableStateOf(DEFAULT_TOOLBAR_HEIGHT) }
|
|
56
|
+
var expanded by remember(behavior) {
|
|
57
|
+
mutableStateOf(if (behavior == DuoBarCompressionBehavior.TOOLBAR) DuoBar.TAB_BAR else DuoBar.TOOLBAR)
|
|
58
|
+
}
|
|
59
|
+
var opened by remember { mutableStateOf<DuoBar?>(null) }
|
|
60
|
+
val setToolbarHeight = remember { { height: Dp -> toolbarHeight = height } }
|
|
61
|
+
val sideBar = layout.sideBar
|
|
62
|
+
|
|
63
|
+
return remember(sideBar, layout.height, tabCount, hasQr, toolbarHeight, expanded, opened) {
|
|
64
|
+
if (sideBar == null) return@remember DuoBarCompression()
|
|
65
|
+
val room = layout.height - sideBar.bottom - sideBar.top - DUO_GROUP_GAP
|
|
66
|
+
val tabBar = duoRailHeight(tabCount, hasQr)
|
|
67
|
+
val compressedTabBar = duoRailHeight(1, hasQr, compressed = true)
|
|
68
|
+
fun fits(toolbar: Dp, tabs: Dp) = toolbar + tabs <= room
|
|
69
|
+
|
|
70
|
+
when {
|
|
71
|
+
fits(toolbarHeight, tabBar) -> DuoBarCompression(setToolbarHeight = setToolbarHeight)
|
|
72
|
+
fits(COMPRESSED_TOOLBAR_HEIGHT, tabBar) && fits(toolbarHeight, compressedTabBar) -> DuoBarCompression(
|
|
73
|
+
toolbarCompressed = expanded == DuoBar.TAB_BAR,
|
|
74
|
+
tabBarCompressed = expanded == DuoBar.TOOLBAR,
|
|
75
|
+
expandToolbar = { expanded = DuoBar.TOOLBAR },
|
|
76
|
+
expandTabBar = { expanded = DuoBar.TAB_BAR },
|
|
77
|
+
setToolbarHeight = setToolbarHeight,
|
|
78
|
+
)
|
|
79
|
+
// an opened rail always shows, even when only the group gap is short: it closes once a tab is picked
|
|
80
|
+
opened == DuoBar.TAB_BAR -> DuoBarCompression(
|
|
81
|
+
toolbarCompressed = true,
|
|
82
|
+
toolbarHidden = true,
|
|
83
|
+
expandToolbar = { opened = DuoBar.TOOLBAR },
|
|
84
|
+
expandTabBar = { opened = DuoBar.TAB_BAR },
|
|
85
|
+
onTabSelected = { opened = null },
|
|
86
|
+
setToolbarHeight = setToolbarHeight,
|
|
87
|
+
)
|
|
88
|
+
else -> DuoBarCompression(
|
|
89
|
+
toolbarCompressed = opened != DuoBar.TOOLBAR,
|
|
90
|
+
tabBarCompressed = true,
|
|
91
|
+
expandToolbar = { opened = DuoBar.TOOLBAR },
|
|
92
|
+
expandTabBar = { opened = DuoBar.TAB_BAR },
|
|
93
|
+
setToolbarHeight = setToolbarHeight,
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.bottomtab
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.Spring
|
|
4
|
+
import androidx.compose.animation.core.animateDpAsState
|
|
5
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
6
|
+
import androidx.compose.animation.core.spring
|
|
7
|
+
import androidx.compose.foundation.background
|
|
8
|
+
import androidx.compose.foundation.clickable
|
|
9
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
10
|
+
import androidx.compose.foundation.interaction.collectIsPressedAsState
|
|
11
|
+
import androidx.compose.foundation.border
|
|
12
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
13
|
+
import androidx.compose.foundation.layout.Box
|
|
14
|
+
import androidx.compose.foundation.layout.BoxScope
|
|
15
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
16
|
+
import androidx.compose.foundation.layout.Column
|
|
17
|
+
import androidx.compose.foundation.layout.Row
|
|
18
|
+
import androidx.compose.foundation.layout.RowScope
|
|
19
|
+
import androidx.compose.foundation.layout.absolutePadding
|
|
20
|
+
import androidx.compose.foundation.layout.fillMaxHeight
|
|
21
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
22
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
23
|
+
import androidx.compose.foundation.layout.height
|
|
24
|
+
import androidx.compose.foundation.layout.offset
|
|
25
|
+
import androidx.compose.foundation.layout.padding
|
|
26
|
+
import androidx.compose.foundation.layout.size
|
|
27
|
+
import androidx.compose.foundation.layout.width
|
|
28
|
+
import androidx.compose.foundation.shape.CircleShape
|
|
29
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
30
|
+
import androidx.compose.runtime.Composable
|
|
31
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
32
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
33
|
+
import androidx.compose.runtime.MutableState
|
|
34
|
+
import androidx.compose.runtime.compositionLocalOf
|
|
35
|
+
import androidx.compose.runtime.getValue
|
|
36
|
+
import androidx.compose.runtime.mutableStateOf
|
|
37
|
+
import androidx.compose.runtime.remember
|
|
38
|
+
import androidx.compose.ui.AbsoluteAlignment
|
|
39
|
+
import androidx.compose.ui.Alignment
|
|
40
|
+
import androidx.compose.ui.Modifier
|
|
41
|
+
import androidx.compose.ui.draw.clip
|
|
42
|
+
import androidx.compose.ui.draw.shadow
|
|
43
|
+
import androidx.compose.ui.graphics.graphicsLayer
|
|
44
|
+
import androidx.compose.ui.graphics.Color
|
|
45
|
+
import androidx.compose.ui.graphics.Shape
|
|
46
|
+
import androidx.compose.ui.semantics.Role
|
|
47
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
48
|
+
import androidx.compose.ui.unit.Dp
|
|
49
|
+
import androidx.compose.ui.unit.dp
|
|
50
|
+
import vn.momo.kits.application.LocalContext
|
|
51
|
+
import vn.momo.kits.application.MiniAppContext
|
|
52
|
+
import vn.momo.kits.components.Badge
|
|
53
|
+
import vn.momo.kits.components.BadgeDot
|
|
54
|
+
import vn.momo.kits.components.DotSize
|
|
55
|
+
import vn.momo.kits.components.Icon
|
|
56
|
+
import vn.momo.kits.components.Text
|
|
57
|
+
import vn.momo.kits.const.AppTheme
|
|
58
|
+
import vn.momo.kits.const.Spacing
|
|
59
|
+
import vn.momo.kits.const.Typography
|
|
60
|
+
import vn.momo.kits.layout.DuoMetrics
|
|
61
|
+
import vn.momo.kits.layout.ScreenLayout
|
|
62
|
+
import vn.momo.kits.layout.SideBarEdge
|
|
63
|
+
import vn.momo.kits.modifier.noFeedbackClickable
|
|
64
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
65
|
+
|
|
66
|
+
// Figma Fold-Design-System MT1/MT2, mirrored from RN DuoTabBar.tsx.
|
|
67
|
+
private val ITEM_SIZE = DuoMetrics.controlSize
|
|
68
|
+
private val ICON_SIZE = 28.dp
|
|
69
|
+
private val QR_ICON_SIZE = 24.dp
|
|
70
|
+
private val RAIL_PADDING = 6.dp
|
|
71
|
+
private val RAIL_GAP = Spacing.XXS
|
|
72
|
+
// selection bubble overflows the 48 rail cell by 5 above and below
|
|
73
|
+
private val RAIL_BUBBLE_WIDTH = 44.dp
|
|
74
|
+
private val RAIL_BUBBLE_HEIGHT = 58.dp
|
|
75
|
+
private val FLOATING_HEIGHT = DuoMetrics.floatingTabBarHeight
|
|
76
|
+
private val FLOATING_PADDING = Spacing.XS
|
|
77
|
+
// the system bar sizes its pill to the tabs instead of stretching it across the display
|
|
78
|
+
private val FLOATING_ITEM_WIDTH = 80.dp
|
|
79
|
+
// while pressed the selection bubble grows into a lens past the pill's edges
|
|
80
|
+
private const val LENS_SCALE_X = 1.2f
|
|
81
|
+
private const val LENS_SCALE_Y = 1.3f
|
|
82
|
+
// Figma Home-2026 tab bar "Selection": brand pink at 8%
|
|
83
|
+
private const val SELECTION_TINT_ALPHA = 0x14 / 255f
|
|
84
|
+
// RN reanimated spring { damping: 18, stiffness: 220, mass: 0.8 }
|
|
85
|
+
private val BUBBLE_SPRING = spring<Dp>(dampingRatio = 0.68f, stiffness = 275f, visibilityThreshold = Dp(0.5f))
|
|
86
|
+
private val LENS_SPRING = spring<Float>(dampingRatio = 0.68f, stiffness = 275f)
|
|
87
|
+
|
|
88
|
+
// Space from the window bottom the rail stack and its gap take, so the header side bar stays above it.
|
|
89
|
+
internal val LocalDuoRailReserve = compositionLocalOf { 0.dp }
|
|
90
|
+
|
|
91
|
+
// Rail plus the QR button under it; compressed, the rail is a single button.
|
|
92
|
+
internal fun duoRailHeight(itemCount: Int, hasQr: Boolean, compressed: Boolean = false): Dp {
|
|
93
|
+
val rail = if (compressed) ITEM_SIZE
|
|
94
|
+
else RAIL_PADDING * 2 + ITEM_SIZE * itemCount + RAIL_GAP * (itemCount - 1).coerceAtLeast(0)
|
|
95
|
+
return rail + if (hasQr) Spacing.M + ITEM_SIZE else 0.dp
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Overlaps the home indicator inset like the system tab bar (21pt above the bottom with a 34pt inset).
|
|
99
|
+
private fun floatingTabBarBottom(insetBottom: Dp): Dp =
|
|
100
|
+
maxOf(insetBottom - DuoMetrics.floatingTabBarInsetOverlap, Spacing.S)
|
|
101
|
+
|
|
102
|
+
// Space tab content leaves under the floating bar; 0 when the rail sits in the side strip or off Duo.
|
|
103
|
+
internal fun duoFloatingTabBarInset(layout: ScreenLayout): Dp =
|
|
104
|
+
if (layout.isIPhoneDuo && layout.sideBar == null) FLOATING_HEIGHT + floatingTabBarBottom(layout.insetBottom) else 0.dp
|
|
105
|
+
|
|
106
|
+
// iPhone Duo tab bar: rail in the side bar, or a floating bar when unfolded portrait.
|
|
107
|
+
@Composable
|
|
108
|
+
internal fun BoxScope.DuoTabBar(
|
|
109
|
+
layout: ScreenLayout,
|
|
110
|
+
items: List<BottomTabItem>,
|
|
111
|
+
floatingButton: BottomTabFloatingButton?,
|
|
112
|
+
selectedIndex: Int,
|
|
113
|
+
onTabSelected: (Int) -> Unit,
|
|
114
|
+
compression: DuoBarCompression = DuoBarCompression(),
|
|
115
|
+
) {
|
|
116
|
+
if (layout.sideBar != null) {
|
|
117
|
+
DuoRailTabBar(layout, items, floatingButton, selectedIndex, onTabSelected, compression)
|
|
118
|
+
} else {
|
|
119
|
+
DuoFloatingTabBar(layout, items, floatingButton, selectedIndex, onTabSelected)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Vertical bar anchored to the bottom of the side bar, QR button below it (Figma MT1-C/E). When the
|
|
124
|
+
// side bar is short it can shrink to one button showing the current tab (HIG "Tab bar compressed");
|
|
125
|
+
// tapping it expands the rail and compresses the toolbar.
|
|
126
|
+
@Composable
|
|
127
|
+
private fun BoxScope.DuoRailTabBar(
|
|
128
|
+
layout: ScreenLayout,
|
|
129
|
+
items: List<BottomTabItem>,
|
|
130
|
+
floatingButton: BottomTabFloatingButton?,
|
|
131
|
+
selectedIndex: Int,
|
|
132
|
+
onTabSelected: (Int) -> Unit,
|
|
133
|
+
compression: DuoBarCompression,
|
|
134
|
+
) {
|
|
135
|
+
val sideBar = layout.sideBar ?: return
|
|
136
|
+
val isRight = sideBar.edge == SideBarEdge.RIGHT
|
|
137
|
+
|
|
138
|
+
Column(
|
|
139
|
+
modifier = Modifier
|
|
140
|
+
.align(if (isRight) AbsoluteAlignment.BottomRight else AbsoluteAlignment.BottomLeft)
|
|
141
|
+
.width(sideBar.width)
|
|
142
|
+
.padding(bottom = sideBar.bottom)
|
|
143
|
+
.absolutePadding(left = if (isRight) Spacing.M else 0.dp, right = if (isRight) 0.dp else Spacing.M),
|
|
144
|
+
horizontalAlignment = if (isRight) AbsoluteAlignment.Left else AbsoluteAlignment.Right,
|
|
145
|
+
verticalArrangement = Arrangement.spacedBy(Spacing.M),
|
|
146
|
+
) {
|
|
147
|
+
val current = items.getOrNull(selectedIndex)
|
|
148
|
+
if (compression.tabBarCompressed && current != null) {
|
|
149
|
+
Box(
|
|
150
|
+
modifier = Modifier
|
|
151
|
+
.size(ITEM_SIZE)
|
|
152
|
+
.tabBarMaterial(CircleShape)
|
|
153
|
+
.noFeedbackClickable(onClick = compression.expandTabBar)
|
|
154
|
+
.setAutomationId("bottom_tab_bar"),
|
|
155
|
+
contentAlignment = Alignment.Center,
|
|
156
|
+
) {
|
|
157
|
+
DuoTabIcon(current, selected = true)
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
Rail(items, selectedIndex) {
|
|
161
|
+
onTabSelected(it)
|
|
162
|
+
compression.onTabSelected()
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (floatingButton != null) {
|
|
166
|
+
QrButton(floatingButton, size = ITEM_SIZE)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Column of icon-only tab items with the sliding selection bubble.
|
|
172
|
+
@Composable
|
|
173
|
+
private fun Rail(items: List<BottomTabItem>, selectedIndex: Int, onItemClick: (Int) -> Unit) {
|
|
174
|
+
val pressedIndex = remember { mutableStateOf<Int?>(null) }
|
|
175
|
+
val bubbleOffset by animateDpAsState(
|
|
176
|
+
targetValue = (ITEM_SIZE + RAIL_GAP) * (pressedIndex.value ?: selectedIndex).coerceAtLeast(0),
|
|
177
|
+
animationSpec = BUBBLE_SPRING,
|
|
178
|
+
label = "DuoRailBubble",
|
|
179
|
+
)
|
|
180
|
+
Box(
|
|
181
|
+
Modifier
|
|
182
|
+
.width(ITEM_SIZE)
|
|
183
|
+
.tabBarMaterial(CircleShape)
|
|
184
|
+
.setAutomationId("bottom_tab_bar")
|
|
185
|
+
) {
|
|
186
|
+
Box(
|
|
187
|
+
Modifier
|
|
188
|
+
.offset(
|
|
189
|
+
x = (ITEM_SIZE - RAIL_BUBBLE_WIDTH) / 2,
|
|
190
|
+
y = RAIL_PADDING - (RAIL_BUBBLE_HEIGHT - ITEM_SIZE) / 2 + bubbleOffset,
|
|
191
|
+
)
|
|
192
|
+
.size(RAIL_BUBBLE_WIDTH, RAIL_BUBBLE_HEIGHT)
|
|
193
|
+
.selectionLens(pressedIndex.value != null)
|
|
194
|
+
)
|
|
195
|
+
Column(
|
|
196
|
+
modifier = Modifier.padding(vertical = RAIL_PADDING),
|
|
197
|
+
verticalArrangement = Arrangement.spacedBy(RAIL_GAP),
|
|
198
|
+
) {
|
|
199
|
+
items.forEachIndexed { index, item ->
|
|
200
|
+
Box(
|
|
201
|
+
modifier = Modifier
|
|
202
|
+
.size(ITEM_SIZE)
|
|
203
|
+
.tabClickable(index, pressedIndex) { onItemClick(index) },
|
|
204
|
+
contentAlignment = Alignment.Center,
|
|
205
|
+
) {
|
|
206
|
+
DuoTabIcon(item, selected = index == selectedIndex)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Floating labelled bar for the unfolded portrait display, QR pinned in its own platter beside it.
|
|
214
|
+
@Composable
|
|
215
|
+
private fun BoxScope.DuoFloatingTabBar(
|
|
216
|
+
layout: ScreenLayout,
|
|
217
|
+
items: List<BottomTabItem>,
|
|
218
|
+
floatingButton: BottomTabFloatingButton?,
|
|
219
|
+
selectedIndex: Int,
|
|
220
|
+
onTabSelected: (Int) -> Unit,
|
|
221
|
+
) {
|
|
222
|
+
val pressedIndex = remember { mutableStateOf<Int?>(null) }
|
|
223
|
+
|
|
224
|
+
Row(
|
|
225
|
+
modifier = Modifier
|
|
226
|
+
.align(Alignment.BottomCenter)
|
|
227
|
+
.fillMaxWidth()
|
|
228
|
+
.absolutePadding(
|
|
229
|
+
left = layout.insetLeft + DuoMetrics.floatingTabBarMargin,
|
|
230
|
+
right = layout.insetRight + DuoMetrics.floatingTabBarMargin,
|
|
231
|
+
)
|
|
232
|
+
.padding(bottom = floatingTabBarBottom(layout.insetBottom)),
|
|
233
|
+
horizontalArrangement = Arrangement.spacedBy(Spacing.S, Alignment.CenterHorizontally),
|
|
234
|
+
) {
|
|
235
|
+
Box(
|
|
236
|
+
modifier = Modifier
|
|
237
|
+
.weight(1f, fill = false)
|
|
238
|
+
.width(FLOATING_ITEM_WIDTH * items.size + FLOATING_PADDING * 2)
|
|
239
|
+
.height(FLOATING_HEIGHT)
|
|
240
|
+
.tabBarMaterial(RoundedCornerShape(FLOATING_HEIGHT / 2))
|
|
241
|
+
.padding(FLOATING_PADDING)
|
|
242
|
+
.setAutomationId("bottom_tab_bar")
|
|
243
|
+
) {
|
|
244
|
+
BoxWithConstraints(Modifier.fillMaxSize()) {
|
|
245
|
+
val cellWidth = maxWidth / items.size.coerceAtLeast(1)
|
|
246
|
+
val bubbleOffset by animateDpAsState(
|
|
247
|
+
targetValue = cellWidth * (pressedIndex.value ?: selectedIndex).coerceAtLeast(0),
|
|
248
|
+
animationSpec = BUBBLE_SPRING,
|
|
249
|
+
label = "DuoFloatingBubble",
|
|
250
|
+
)
|
|
251
|
+
Box(
|
|
252
|
+
Modifier
|
|
253
|
+
.offset(x = bubbleOffset)
|
|
254
|
+
.width(cellWidth)
|
|
255
|
+
.fillMaxHeight()
|
|
256
|
+
.selectionLens(pressedIndex.value != null)
|
|
257
|
+
)
|
|
258
|
+
Row(Modifier.fillMaxSize()) {
|
|
259
|
+
items.forEachIndexed { index, item ->
|
|
260
|
+
FloatingCell(item, selected = index == selectedIndex, index, pressedIndex) {
|
|
261
|
+
onTabSelected(index)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (floatingButton != null) {
|
|
268
|
+
QrButton(floatingButton, size = FLOATING_HEIGHT, Modifier.shadow(3.dp, CircleShape))
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@Composable
|
|
274
|
+
private fun RowScope.FloatingCell(
|
|
275
|
+
item: BottomTabItem,
|
|
276
|
+
selected: Boolean,
|
|
277
|
+
index: Int,
|
|
278
|
+
pressedIndex: MutableState<Int?>,
|
|
279
|
+
onClick: () -> Unit,
|
|
280
|
+
) {
|
|
281
|
+
val colors = AppTheme.current.colors
|
|
282
|
+
Column(
|
|
283
|
+
modifier = Modifier
|
|
284
|
+
.weight(1f)
|
|
285
|
+
.fillMaxHeight()
|
|
286
|
+
.tabClickable(index, pressedIndex, onClick),
|
|
287
|
+
horizontalAlignment = Alignment.CenterHorizontally,
|
|
288
|
+
verticalArrangement = Arrangement.spacedBy(Spacing.XXS, Alignment.CenterVertically),
|
|
289
|
+
) {
|
|
290
|
+
DuoTabIcon(item, selected)
|
|
291
|
+
// like the system tab bar the label keeps its design size; Text grows it up to 5pt on the wide Duo displays
|
|
292
|
+
val context = LocalContext.current
|
|
293
|
+
val fixedScale = remember(context) {
|
|
294
|
+
(context ?: MiniAppContext()).copy(userScaleRate = 1f, useOSScaleRate = false)
|
|
295
|
+
}
|
|
296
|
+
CompositionLocalProvider(LocalContext provides fixedScale) {
|
|
297
|
+
Text(
|
|
298
|
+
text = item.label,
|
|
299
|
+
style = Typography.labelXsMedium,
|
|
300
|
+
color = if (selected) colors.primary else colors.text.hint,
|
|
301
|
+
maxLines = 1,
|
|
302
|
+
overflow = TextOverflow.Ellipsis,
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Tracks the finger so the selection lens jumps to the pressed tab before it is selected.
|
|
309
|
+
@Composable
|
|
310
|
+
private fun Modifier.tabClickable(index: Int, pressedIndex: MutableState<Int?>, onClick: () -> Unit): Modifier {
|
|
311
|
+
val interactionSource = remember { MutableInteractionSource() }
|
|
312
|
+
val pressed by interactionSource.collectIsPressedAsState()
|
|
313
|
+
LaunchedEffect(pressed) {
|
|
314
|
+
if (pressed) pressedIndex.value = index
|
|
315
|
+
else if (pressedIndex.value == index) pressedIndex.value = null
|
|
316
|
+
}
|
|
317
|
+
return clickable(interactionSource = interactionSource, indication = null, role = Role.Tab, onClick = onClick)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Selection bubble; while pressed it grows into a lens (80x54 to about 96x70).
|
|
321
|
+
@Composable
|
|
322
|
+
private fun Modifier.selectionLens(pressed: Boolean): Modifier {
|
|
323
|
+
val lens by animateFloatAsState(if (pressed) 1f else 0f, LENS_SPRING, label = "DuoSelectionLens")
|
|
324
|
+
val tint = AppTheme.current.colors.primary.copy(alpha = SELECTION_TINT_ALPHA)
|
|
325
|
+
return graphicsLayer {
|
|
326
|
+
scaleX = 1 + lens * (LENS_SCALE_X - 1)
|
|
327
|
+
scaleY = 1 + lens * (LENS_SCALE_Y - 1)
|
|
328
|
+
}.background(tint, CircleShape)
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
@Composable
|
|
332
|
+
private fun DuoTabIcon(item: BottomTabItem, selected: Boolean) {
|
|
333
|
+
val colors = AppTheme.current.colors
|
|
334
|
+
val badgeLabel = item.badgeLabel?.takeUnless { it.toIntOrNull() == 0 }
|
|
335
|
+
Box {
|
|
336
|
+
Icon(
|
|
337
|
+
source = item.icon,
|
|
338
|
+
size = ICON_SIZE,
|
|
339
|
+
color = if (selected) colors.primary else colors.text.hint,
|
|
340
|
+
)
|
|
341
|
+
when {
|
|
342
|
+
badgeLabel == null && !item.showDot -> Unit
|
|
343
|
+
badgeLabel.isNullOrEmpty() -> BadgeDot(
|
|
344
|
+
size = DotSize.Small,
|
|
345
|
+
modifier = Modifier.align(Alignment.TopEnd),
|
|
346
|
+
)
|
|
347
|
+
else -> Badge(
|
|
348
|
+
badgeLabel,
|
|
349
|
+
modifier = Modifier.align(Alignment.TopStart).offset(x = ICON_SIZE / 2, y = -Spacing.XS),
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@Composable
|
|
356
|
+
private fun QrButton(data: BottomTabFloatingButton, size: Dp, modifier: Modifier = Modifier) {
|
|
357
|
+
Box(
|
|
358
|
+
modifier = modifier
|
|
359
|
+
.size(size)
|
|
360
|
+
.clip(CircleShape)
|
|
361
|
+
.background(AppTheme.current.colors.primary)
|
|
362
|
+
.noFeedbackClickable(onClick = data.onPress)
|
|
363
|
+
.setAutomationId(data.label),
|
|
364
|
+
contentAlignment = Alignment.Center,
|
|
365
|
+
) {
|
|
366
|
+
Icon(source = data.icon, color = Color.White, size = QR_ICON_SIZE)
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// RN BarMaterial: surface with a 1dp border.
|
|
371
|
+
@Composable
|
|
372
|
+
private fun Modifier.tabBarMaterial(shape: Shape): Modifier {
|
|
373
|
+
val colors = AppTheme.current.colors
|
|
374
|
+
return shadow(3.dp, shape)
|
|
375
|
+
.background(colors.background.surface)
|
|
376
|
+
.border(1.dp, colors.border.default, shape)
|
|
377
|
+
}
|