@momo-kits/native-kits 0.157.1-skill.1 → 0.157.1-skill.3-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/.claude/momo-native-kits-skill/SKILL.md +51 -0
- package/.claude/momo-native-kits-skill/evals/evals.json +95 -0
- package/.claude/momo-native-kits-skill/references/badge.md +52 -0
- package/.claude/momo-native-kits-skill/references/button.md +182 -0
- package/.claude/momo-native-kits-skill/references/card.md +48 -0
- package/.claude/momo-native-kits-skill/references/checkbox.md +51 -0
- package/.claude/momo-native-kits-skill/references/chip.md +48 -0
- package/.claude/momo-native-kits-skill/references/constants.md +260 -0
- package/.claude/momo-native-kits-skill/references/divider.md +26 -0
- package/.claude/momo-native-kits-skill/references/input.md +408 -0
- package/.claude/momo-native-kits-skill/references/navigation.md +475 -0
- package/.claude/momo-native-kits-skill/references/popup.md +97 -0
- package/.claude/momo-native-kits-skill/references/radio.md +60 -0
- package/.claude/momo-native-kits-skill/references/skeleton.md +40 -0
- package/.claude/momo-native-kits-skill/references/snackbar.md +54 -0
- package/.claude/momo-native-kits-skill/references/switch.md +62 -0
- package/.claude/momo-native-kits-skill/references/text.md +195 -0
- package/.claude/momo-native-kits-skill/references/tooltip.md +34 -0
- package/.claude/momo-native-kits-skill/references/trustbanner.md +61 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.json +20 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.md +13 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/with_skill/outputs/ButtonExample.kt +55 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/without_skill/outputs/ButtonExample.kt +45 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/with_skill/outputs/InputPhoneExample.kt +40 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/without_skill/outputs/InputPhoneExample.kt +42 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/with_skill/outputs/BottomTabExample.kt +236 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/without_skill/outputs/BottomTabExample.kt +152 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/with_skill/outputs/CheckBoxExample.kt +49 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/without_skill/outputs/CheckBoxExample.kt +123 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/with_skill/outputs/DateTimePickerExample.kt +318 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/without_skill/outputs/DateTimePickerExample.kt +330 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/with_skill/outputs/CardExample.kt +124 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/without_skill/outputs/CardExample.kt +71 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/with_skill/outputs/LoginFormExample.kt +134 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/without_skill/outputs/LoginFormExample.kt +199 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +224 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/without_skill/outputs/NavigationContainerExample.kt +225 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/with_skill/outputs/PopupExample.kt +79 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/without_skill/outputs/PopupExample.kt +169 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +255 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +212 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/with_skill/outputs/SkeletonExample.kt +199 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/without_skill/outputs/SkeletonExample.kt +229 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.json +20 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.md +13 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/eval_metadata.json +22 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/outputs/PrimaryButtonExample.kt +38 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/outputs/PrimaryButtonExample.kt +83 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/eval_metadata.json +22 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +547 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/outputs/MoMoNavigationContainer.kt +519 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/eval_metadata.json +27 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +429 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +353 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/timing.json +5 -0
- package/.claude/settings.local.json +35 -7
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +180 -0
- package/compose/build.gradle.kts.backup +180 -0
- package/compose/compose.podspec +54 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +110 -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/Context.kt +107 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +305 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +720 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +405 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +85 -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 +340 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +198 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +94 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +136 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +448 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +255 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +254 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +241 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -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 +92 -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 +352 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +130 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +590 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +177 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +205 -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 +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -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 +13 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +285 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -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 +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -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 +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +119 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +98 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +161 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +331 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +497 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +162 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +243 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +279 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +42 -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 +62 -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 +88 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +149 -0
- package/gradle/libs.versions.toml +57 -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/Input/Input.swift +112 -50
- package/local.properties +8 -0
- package/package.json +1 -1
- package/settings.gradle.kts +52 -0
- package/.claude/momo-native-kits/SKILL.md +0 -87
- package/.claude/momo-native-kits/references/Badge.md +0 -39
- package/.claude/momo-native-kits/references/BadgeDot.md +0 -37
- package/.claude/momo-native-kits/references/BottomSheet.md +0 -51
- package/.claude/momo-native-kits/references/BottomTab.md +0 -65
- package/.claude/momo-native-kits/references/Button.md +0 -197
- package/.claude/momo-native-kits/references/CheckBox.md +0 -51
- package/.claude/momo-native-kits/references/Chip.md +0 -47
- package/.claude/momo-native-kits/references/Divider.md +0 -29
- package/.claude/momo-native-kits/references/HeaderTitle.md +0 -45
- package/.claude/momo-native-kits/references/HeaderType.md +0 -47
- package/.claude/momo-native-kits/references/Icon.md +0 -32
- package/.claude/momo-native-kits/references/Image.md +0 -38
- package/.claude/momo-native-kits/references/Information.md +0 -36
- package/.claude/momo-native-kits/references/Input.md +0 -334
- package/.claude/momo-native-kits/references/InputDropDown.md +0 -47
- package/.claude/momo-native-kits/references/InputMoney.md +0 -241
- package/.claude/momo-native-kits/references/InputOTP.md +0 -52
- package/.claude/momo-native-kits/references/InputPhoneNumber.md +0 -175
- package/.claude/momo-native-kits/references/InputSearch.md +0 -57
- package/.claude/momo-native-kits/references/InputTextArea.md +0 -46
- package/.claude/momo-native-kits/references/NavigationContainer.md +0 -51
- package/.claude/momo-native-kits/references/Navigator.md +0 -287
- package/.claude/momo-native-kits/references/PaginationDot.md +0 -28
- package/.claude/momo-native-kits/references/PaginationNumber.md +0 -28
- package/.claude/momo-native-kits/references/PopupNotify.md +0 -47
- package/.claude/momo-native-kits/references/Radio.md +0 -44
- package/.claude/momo-native-kits/references/Skeleton.md +0 -32
- package/.claude/momo-native-kits/references/Switch.md +0 -36
- package/.claude/momo-native-kits/references/Tag.md +0 -40
- package/.claude/momo-native-kits/references/Text.md +0 -37
- package/.claude/momo-native-kits/references/Title.md +0 -43
- package/.claude/momo-native-kits/references/Tooltip.md +0 -30
- package/building-skill-for-claude.md +0 -1190
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.bottomtab
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.FastOutSlowInEasing
|
|
4
|
+
import androidx.compose.animation.core.animateDpAsState
|
|
5
|
+
import androidx.compose.animation.core.tween
|
|
6
|
+
import androidx.compose.foundation.background
|
|
7
|
+
import androidx.compose.foundation.border
|
|
8
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
9
|
+
import androidx.compose.foundation.layout.Box
|
|
10
|
+
import androidx.compose.foundation.layout.Column
|
|
11
|
+
import androidx.compose.foundation.layout.Row
|
|
12
|
+
import androidx.compose.foundation.layout.RowScope
|
|
13
|
+
import androidx.compose.foundation.layout.Spacer
|
|
14
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
15
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
16
|
+
import androidx.compose.foundation.layout.height
|
|
17
|
+
import androidx.compose.foundation.layout.offset
|
|
18
|
+
import androidx.compose.foundation.layout.padding
|
|
19
|
+
import androidx.compose.foundation.layout.size
|
|
20
|
+
import androidx.compose.foundation.layout.width
|
|
21
|
+
import androidx.compose.foundation.shape.CircleShape
|
|
22
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
23
|
+
import androidx.compose.runtime.Composable
|
|
24
|
+
import androidx.compose.runtime.getValue
|
|
25
|
+
import androidx.compose.ui.Alignment
|
|
26
|
+
import androidx.compose.ui.Modifier
|
|
27
|
+
import androidx.compose.ui.draw.clip
|
|
28
|
+
import androidx.compose.ui.graphics.Brush
|
|
29
|
+
import androidx.compose.ui.graphics.Color
|
|
30
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
31
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
32
|
+
import androidx.compose.ui.unit.dp
|
|
33
|
+
import androidx.navigation.NavController
|
|
34
|
+
import androidx.navigation.compose.currentBackStackEntryAsState
|
|
35
|
+
import vn.momo.kits.components.Badge
|
|
36
|
+
import vn.momo.kits.components.Icon
|
|
37
|
+
import vn.momo.kits.components.Text
|
|
38
|
+
import vn.momo.kits.const.AppTheme
|
|
39
|
+
import vn.momo.kits.const.Colors
|
|
40
|
+
import vn.momo.kits.const.Radius
|
|
41
|
+
import vn.momo.kits.const.Spacing
|
|
42
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
43
|
+
import vn.momo.kits.components.BadgeDot
|
|
44
|
+
import vn.momo.kits.components.DotSize
|
|
45
|
+
import vn.momo.kits.const.Typography
|
|
46
|
+
import vn.momo.kits.modifier.conditional
|
|
47
|
+
import vn.momo.kits.modifier.noFeedbackClickable
|
|
48
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
49
|
+
|
|
50
|
+
val floatingButtonWidth = 75.dp
|
|
51
|
+
const val BOTTOM_TAB_BAR_HEIGHT = 64
|
|
52
|
+
|
|
53
|
+
@Composable
|
|
54
|
+
fun BottomTabBar(
|
|
55
|
+
items: List<BottomTabItem>,
|
|
56
|
+
floatingButton: BottomTabFloatingButton? = null,
|
|
57
|
+
navController: NavController,
|
|
58
|
+
onTabSelected: (Int) -> Unit,
|
|
59
|
+
) {
|
|
60
|
+
val currentRoute = navController.currentBackStackEntryAsState().value?.destination?.route
|
|
61
|
+
val selectedIndex = items.indexOfFirst { "option${items.indexOf(it)}" == currentRoute }
|
|
62
|
+
|
|
63
|
+
val screenWidth = getScreenDimensions().width.dp
|
|
64
|
+
val mid = items.size / 2
|
|
65
|
+
|
|
66
|
+
val tabWidth = if (floatingButton != null) {
|
|
67
|
+
(screenWidth - floatingButtonWidth) / items.size
|
|
68
|
+
} else {
|
|
69
|
+
screenWidth / items.size
|
|
70
|
+
}
|
|
71
|
+
val adjustSize = if(floatingButton != null && selectedIndex >= mid) floatingButtonWidth else 0.dp
|
|
72
|
+
val targetOffset = tabWidth * selectedIndex + tabWidth / 2 - screenWidth / 2 + adjustSize
|
|
73
|
+
|
|
74
|
+
val indicatorOffsetX by animateDpAsState(
|
|
75
|
+
targetValue = targetOffset,
|
|
76
|
+
animationSpec = tween(durationMillis = 250, easing = FastOutSlowInEasing),
|
|
77
|
+
label = "IndicatorX"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
Box(
|
|
81
|
+
contentAlignment = Alignment.BottomCenter
|
|
82
|
+
) {
|
|
83
|
+
Row(
|
|
84
|
+
modifier = Modifier
|
|
85
|
+
.fillMaxWidth()
|
|
86
|
+
.height(BOTTOM_TAB_BAR_HEIGHT.dp)
|
|
87
|
+
.background(AppTheme.current.colors.background.surface)
|
|
88
|
+
.conditional(IsShowBaseLineDebug) {
|
|
89
|
+
border(1.dp, Colors.blue_03)
|
|
90
|
+
},
|
|
91
|
+
horizontalArrangement = Arrangement.SpaceAround,
|
|
92
|
+
) {
|
|
93
|
+
if (floatingButton == null) {
|
|
94
|
+
renderTabBarItem(items, 0, items.size, selectedIndex, onTabSelected)
|
|
95
|
+
} else {
|
|
96
|
+
renderTabBarItem(items, 0, mid, selectedIndex, onTabSelected)
|
|
97
|
+
Spacer(modifier = Modifier.width(floatingButtonWidth).padding(horizontal = Spacing.XXS))
|
|
98
|
+
renderTabBarItem(items, mid, items.size, selectedIndex, onTabSelected)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Box(modifier = Modifier
|
|
103
|
+
.offset(x = indicatorOffsetX, y = (-BOTTOM_TAB_BAR_HEIGHT + 2).dp)
|
|
104
|
+
.height(2.dp)
|
|
105
|
+
.width(44.dp)
|
|
106
|
+
.background(
|
|
107
|
+
color = AppTheme.current.colors.primary ,
|
|
108
|
+
shape = RoundedCornerShape(bottomStart = 2.dp, bottomEnd = 2.dp)
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
Box(modifier = Modifier
|
|
113
|
+
.fillMaxWidth()
|
|
114
|
+
.height(6.dp)
|
|
115
|
+
.offset(x = 0.dp, y = (-BOTTOM_TAB_BAR_HEIGHT).dp)
|
|
116
|
+
.background(
|
|
117
|
+
brush = Brush.verticalGradient(
|
|
118
|
+
colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
floatingButton?.let { FloatingButton(it) }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Composable
|
|
127
|
+
fun RowScope.renderTabBarItem(
|
|
128
|
+
items: List<BottomTabItem>,
|
|
129
|
+
fromIndex: Int,
|
|
130
|
+
toIndex: Int,
|
|
131
|
+
selectedIndex: Int,
|
|
132
|
+
onTabSelected: (Int) -> Unit
|
|
133
|
+
){
|
|
134
|
+
for (index in fromIndex until toIndex) {
|
|
135
|
+
Box(modifier = Modifier.weight(1f)) {
|
|
136
|
+
TabBarItem(
|
|
137
|
+
item = items[index],
|
|
138
|
+
selected = index == selectedIndex,
|
|
139
|
+
onClick = { onTabSelected(index) }
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Composable
|
|
146
|
+
fun TabBarItem(item: BottomTabItem, selected: Boolean, onClick: () -> Unit) {
|
|
147
|
+
fun isNumber(label: String): Boolean {
|
|
148
|
+
val numberRegex = "^\\d+$".toRegex()
|
|
149
|
+
return numberRegex.matches(label)
|
|
150
|
+
}
|
|
151
|
+
fun formatLabel(label: String): String? {
|
|
152
|
+
if (isNumber(label) && label.toInt() == 0) {
|
|
153
|
+
return null
|
|
154
|
+
}
|
|
155
|
+
return label
|
|
156
|
+
}
|
|
157
|
+
val badgeLabel = item.badgeLabel?.let { formatLabel(it) }
|
|
158
|
+
|
|
159
|
+
Box(modifier = Modifier
|
|
160
|
+
.fillMaxSize()
|
|
161
|
+
.padding(horizontal = Spacing.XXS)
|
|
162
|
+
.conditional(IsShowBaseLineDebug) {
|
|
163
|
+
border(1.dp, Colors.blue_03)
|
|
164
|
+
}
|
|
165
|
+
.noFeedbackClickable {
|
|
166
|
+
onClick()
|
|
167
|
+
},
|
|
168
|
+
contentAlignment = Alignment.BottomStart
|
|
169
|
+
){
|
|
170
|
+
Column(
|
|
171
|
+
modifier = Modifier
|
|
172
|
+
.fillMaxSize()
|
|
173
|
+
.padding(horizontal = Spacing.S, vertical = Spacing.S)
|
|
174
|
+
.noFeedbackClickable {
|
|
175
|
+
onClick()
|
|
176
|
+
},
|
|
177
|
+
horizontalAlignment = Alignment.CenterHorizontally,
|
|
178
|
+
verticalArrangement = Arrangement.Center
|
|
179
|
+
) {
|
|
180
|
+
Icon(
|
|
181
|
+
source = item.icon,
|
|
182
|
+
size = 28.dp,
|
|
183
|
+
modifier = Modifier.padding(Spacing.XS),
|
|
184
|
+
color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint)
|
|
185
|
+
Text(
|
|
186
|
+
text = item.label,
|
|
187
|
+
color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint,
|
|
188
|
+
style = if (selected) Typography.labelXsMedium else Typography.descriptionXsRegular,
|
|
189
|
+
maxLines = 1,
|
|
190
|
+
overflow = TextOverflow.Ellipsis
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
if (badgeLabel != null) {
|
|
194
|
+
if (badgeLabel.isEmpty())
|
|
195
|
+
BadgeDot(
|
|
196
|
+
size = DotSize.Small,
|
|
197
|
+
modifier = Modifier.offset(x = 50.dp, y = (-48).dp)
|
|
198
|
+
)
|
|
199
|
+
else
|
|
200
|
+
Badge(badgeLabel, modifier = Modifier.offset(x = 44.dp, y = (-42).dp))
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@Composable
|
|
206
|
+
fun FloatingButton(data: BottomTabFloatingButton) {
|
|
207
|
+
Column(
|
|
208
|
+
modifier = Modifier
|
|
209
|
+
.width(floatingButtonWidth)
|
|
210
|
+
.padding(horizontal = Spacing.XXS, vertical = Spacing.S)
|
|
211
|
+
.conditional(IsShowBaseLineDebug) {
|
|
212
|
+
border(1.dp, Colors.blue_03)
|
|
213
|
+
}
|
|
214
|
+
.noFeedbackClickable {
|
|
215
|
+
data.onPress()
|
|
216
|
+
},
|
|
217
|
+
verticalArrangement = Arrangement.Bottom,
|
|
218
|
+
horizontalAlignment = Alignment.CenterHorizontally
|
|
219
|
+
|
|
220
|
+
){
|
|
221
|
+
CurvedContainer()
|
|
222
|
+
Box(
|
|
223
|
+
modifier = Modifier
|
|
224
|
+
.size(48.dp)
|
|
225
|
+
.clip(CircleShape)
|
|
226
|
+
.background(AppTheme.current.colors.primary),
|
|
227
|
+
contentAlignment = Alignment.Center
|
|
228
|
+
) {
|
|
229
|
+
Icon(source = data.icon, color = Color.White, size = 28.dp)
|
|
230
|
+
}
|
|
231
|
+
Spacer(modifier = Modifier.height(4.dp))
|
|
232
|
+
Text(
|
|
233
|
+
text = data.label,
|
|
234
|
+
style = Typography.labelXsMedium,
|
|
235
|
+
color = Colors.black_01,
|
|
236
|
+
textAlign = TextAlign.Center,
|
|
237
|
+
modifier = Modifier
|
|
238
|
+
.height(14.dp)
|
|
239
|
+
.fillMaxWidth()
|
|
240
|
+
.background(AppTheme.current.colors.primary, shape = RoundedCornerShape(size = Radius.XL))
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -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
|
+
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,187 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.component
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.AnimatedVisibility
|
|
4
|
+
import androidx.compose.animation.core.CubicBezierEasing
|
|
5
|
+
import androidx.compose.animation.core.LinearEasing
|
|
6
|
+
import androidx.compose.animation.core.animateDpAsState
|
|
7
|
+
import androidx.compose.animation.core.tween
|
|
8
|
+
import androidx.compose.animation.expandHorizontally
|
|
9
|
+
import androidx.compose.animation.fadeIn
|
|
10
|
+
import androidx.compose.animation.fadeOut
|
|
11
|
+
import androidx.compose.animation.shrinkHorizontally
|
|
12
|
+
import androidx.compose.foundation.ScrollState
|
|
13
|
+
import androidx.compose.foundation.background
|
|
14
|
+
import androidx.compose.foundation.border
|
|
15
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
16
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
17
|
+
import androidx.compose.foundation.layout.Box
|
|
18
|
+
import androidx.compose.foundation.layout.Row
|
|
19
|
+
import androidx.compose.foundation.layout.Spacer
|
|
20
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
21
|
+
import androidx.compose.foundation.layout.height
|
|
22
|
+
import androidx.compose.foundation.layout.offset
|
|
23
|
+
import androidx.compose.foundation.layout.padding
|
|
24
|
+
import androidx.compose.foundation.layout.sizeIn
|
|
25
|
+
import androidx.compose.foundation.layout.width
|
|
26
|
+
import androidx.compose.material3.AlertDialogDefaults
|
|
27
|
+
import androidx.compose.material3.FloatingActionButton
|
|
28
|
+
import androidx.compose.material3.FloatingActionButtonDefaults
|
|
29
|
+
import androidx.compose.material3.FloatingActionButtonElevation
|
|
30
|
+
import androidx.compose.runtime.Composable
|
|
31
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
32
|
+
import androidx.compose.runtime.getValue
|
|
33
|
+
import androidx.compose.runtime.mutableStateOf
|
|
34
|
+
import androidx.compose.runtime.remember
|
|
35
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
36
|
+
import androidx.compose.runtime.saveable.rememberSaveable
|
|
37
|
+
import androidx.compose.runtime.setValue
|
|
38
|
+
import androidx.compose.ui.Alignment
|
|
39
|
+
import androidx.compose.ui.Modifier
|
|
40
|
+
import androidx.compose.ui.graphics.Color
|
|
41
|
+
import androidx.compose.ui.unit.Dp
|
|
42
|
+
import androidx.compose.ui.unit.dp
|
|
43
|
+
import kotlinx.coroutines.delay
|
|
44
|
+
import kotlinx.coroutines.flow.MutableStateFlow
|
|
45
|
+
import kotlinx.coroutines.flow.collectLatest
|
|
46
|
+
import kotlinx.coroutines.launch
|
|
47
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
48
|
+
import vn.momo.kits.components.Icon
|
|
49
|
+
import vn.momo.kits.components.Text
|
|
50
|
+
import vn.momo.kits.const.Colors
|
|
51
|
+
import vn.momo.kits.const.Typography
|
|
52
|
+
import vn.momo.kits.modifier.conditional
|
|
53
|
+
|
|
54
|
+
enum class FABSize { SMALL, DEFAULT }
|
|
55
|
+
enum class FABPosition { END, CENTER }
|
|
56
|
+
|
|
57
|
+
data class FloatingButtonProps(
|
|
58
|
+
val icon: String,
|
|
59
|
+
val iconColor: Color? = null,
|
|
60
|
+
val label: String? = null,
|
|
61
|
+
val onClick: () -> Unit,
|
|
62
|
+
val size: FABSize = FABSize.DEFAULT,
|
|
63
|
+
val bottom: Dp? = null,
|
|
64
|
+
val scrollState: ScrollState? = null,
|
|
65
|
+
val position: FABPosition? = FABPosition.END,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
private val FabSmallSize = 36.dp
|
|
69
|
+
private val FabDefaultSize = 48.dp
|
|
70
|
+
private val FabExpandedWidth = 80.dp
|
|
71
|
+
private val FabIconSizeSmall = 12.dp
|
|
72
|
+
private val FabIconSizeDefault = 24.dp
|
|
73
|
+
private val FabPaddingHorizontal = 12.dp
|
|
74
|
+
|
|
75
|
+
@Composable
|
|
76
|
+
fun FloatingButton(
|
|
77
|
+
scrollPosition: Int,
|
|
78
|
+
bottom: Dp,
|
|
79
|
+
onClick: () -> Unit,
|
|
80
|
+
containerColor: Color,
|
|
81
|
+
contentColor: Color = containerColor,
|
|
82
|
+
icon: String,
|
|
83
|
+
iconColor: Color? = null,
|
|
84
|
+
text: String? = null,
|
|
85
|
+
elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(4.dp),
|
|
86
|
+
size: FABSize = FABSize.DEFAULT,
|
|
87
|
+
position: FABPosition = FABPosition.END,
|
|
88
|
+
keyboardSize: Dp = 0.dp,
|
|
89
|
+
) {
|
|
90
|
+
val scrollStateFlow = remember { MutableStateFlow(scrollPosition) }
|
|
91
|
+
var lastScrollPosition by rememberSaveable { mutableStateOf(0) }
|
|
92
|
+
var isExpanded by rememberSaveable { mutableStateOf(false) }
|
|
93
|
+
|
|
94
|
+
val coroutineScope = rememberCoroutineScope()
|
|
95
|
+
|
|
96
|
+
// Animations
|
|
97
|
+
val baseSize = if (size == FABSize.SMALL) FabSmallSize else FabDefaultSize
|
|
98
|
+
val width by animateDpAsState(
|
|
99
|
+
targetValue = if (isExpanded && text != null) FabExpandedWidth else baseSize,
|
|
100
|
+
animationSpec = tween(100, easing = CubicBezierEasing(0.2f, 0.2f, 0.2f, 0.2f))
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
// Scroll listener
|
|
104
|
+
LaunchedEffect(text) {
|
|
105
|
+
if (text != null) {
|
|
106
|
+
coroutineScope.launch {
|
|
107
|
+
scrollStateFlow.collectLatest { newScroll ->
|
|
108
|
+
isExpanded = newScroll <= lastScrollPosition
|
|
109
|
+
delay(100)
|
|
110
|
+
lastScrollPosition = newScroll
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
LaunchedEffect(scrollPosition) {
|
|
117
|
+
scrollStateFlow.value = scrollPosition
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Box(
|
|
121
|
+
modifier = Modifier
|
|
122
|
+
.fillMaxSize()
|
|
123
|
+
.padding(end = 12.dp, bottom = bottom)
|
|
124
|
+
.offset(y = -keyboardSize)
|
|
125
|
+
.background(Color.Transparent),
|
|
126
|
+
contentAlignment = if (position == FABPosition.END) Alignment.BottomEnd else Alignment.BottomCenter,
|
|
127
|
+
) {
|
|
128
|
+
FloatingActionButton(
|
|
129
|
+
onClick = onClick,
|
|
130
|
+
shape = AlertDialogDefaults.shape,
|
|
131
|
+
containerColor = containerColor,
|
|
132
|
+
contentColor = contentColor,
|
|
133
|
+
elevation = elevation,
|
|
134
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
135
|
+
modifier = Modifier
|
|
136
|
+
.sizeIn(minWidth = width)
|
|
137
|
+
.height(baseSize)
|
|
138
|
+
.conditional(IsShowBaseLineDebug) {
|
|
139
|
+
border(1.dp, Colors.blue_03)
|
|
140
|
+
}
|
|
141
|
+
) {
|
|
142
|
+
Row(
|
|
143
|
+
modifier = Modifier.padding(
|
|
144
|
+
start = if (isExpanded) FabPaddingHorizontal else 0.dp,
|
|
145
|
+
end = if (isExpanded) FabPaddingHorizontal else 0.dp,
|
|
146
|
+
),
|
|
147
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
148
|
+
horizontalArrangement = if (isExpanded) Arrangement.Start else Arrangement.Center
|
|
149
|
+
) {
|
|
150
|
+
Icon(
|
|
151
|
+
source = icon,
|
|
152
|
+
size = if (size == FABSize.SMALL) FabIconSizeSmall else FabIconSizeDefault,
|
|
153
|
+
color = iconColor ?: Color.White
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
AnimatedVisibility(
|
|
157
|
+
visible = isExpanded,
|
|
158
|
+
enter = fadeInExpandAnimation,
|
|
159
|
+
exit = fadeOutShrinkAnimation,
|
|
160
|
+
) {
|
|
161
|
+
Row {
|
|
162
|
+
Spacer(Modifier.width(12.dp))
|
|
163
|
+
Text(
|
|
164
|
+
text = text ?: "",
|
|
165
|
+
color = Color.White,
|
|
166
|
+
style = Typography.actionDefaultBold
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private val fadeOutShrinkAnimation = fadeOut(
|
|
176
|
+
animationSpec = tween(100, easing = LinearEasing)
|
|
177
|
+
) + shrinkHorizontally(
|
|
178
|
+
animationSpec = tween(100, easing = LinearEasing),
|
|
179
|
+
shrinkTowards = Alignment.Start
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
private val fadeInExpandAnimation = fadeIn(
|
|
183
|
+
animationSpec = tween(100, easing = LinearEasing)
|
|
184
|
+
) + expandHorizontally(
|
|
185
|
+
animationSpec = tween(100, easing = LinearEasing),
|
|
186
|
+
expandFrom = Alignment.Start
|
|
187
|
+
)
|