@momo-kits/native-kits 0.158.1-beta.1 → 0.158.1-beta.2-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 +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 +117 -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/Avatar.kt +157 -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/Carousel.kt +123 -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/Collapse.kt +224 -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/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 +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/ProgressInfo.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -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 +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +348 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +531 -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/Uploader.kt +192 -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 +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -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 +50 -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 +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +99 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +164 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +333 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +552 -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/navigation/tracking/ScreenTracker.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +46 -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 +161 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -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/local.properties +8 -0
- package/package.json +1 -1
- package/settings.gradle.kts +52 -0
- package/.claude/settings.local.json +0 -11
- package/.claude/skills/design-system/SKILL.md +0 -88
- package/.claude/skills/design-system/references/components/avatar.md +0 -134
- package/.claude/skills/design-system/references/components/badge.md +0 -127
- package/.claude/skills/design-system/references/components/bottom-tab.md +0 -177
- package/.claude/skills/design-system/references/components/bottomsheet.md +0 -170
- package/.claude/skills/design-system/references/components/button.md +0 -206
- package/.claude/skills/design-system/references/components/carousel.md +0 -117
- package/.claude/skills/design-system/references/components/checkbox.md +0 -98
- package/.claude/skills/design-system/references/components/chip.md +0 -146
- package/.claude/skills/design-system/references/components/collapse.md +0 -120
- package/.claude/skills/design-system/references/components/date-picker.md +0 -119
- package/.claude/skills/design-system/references/components/divider.md +0 -84
- package/.claude/skills/design-system/references/components/icon.md +0 -130
- package/.claude/skills/design-system/references/components/image.md +0 -81
- package/.claude/skills/design-system/references/components/information.md +0 -107
- package/.claude/skills/design-system/references/components/input-dropdown.md +0 -138
- package/.claude/skills/design-system/references/components/input-money.md +0 -157
- package/.claude/skills/design-system/references/components/input-otp.md +0 -132
- package/.claude/skills/design-system/references/components/input-phone-number.md +0 -140
- package/.claude/skills/design-system/references/components/input-search.md +0 -124
- package/.claude/skills/design-system/references/components/input-text-area.md +0 -133
- package/.claude/skills/design-system/references/components/input.md +0 -152
- package/.claude/skills/design-system/references/components/loader.md +0 -87
- package/.claude/skills/design-system/references/components/pagination.md +0 -105
- package/.claude/skills/design-system/references/components/popup-notify.md +0 -128
- package/.claude/skills/design-system/references/components/progress-info.md +0 -114
- package/.claude/skills/design-system/references/components/radio.md +0 -86
- package/.claude/skills/design-system/references/components/rating.md +0 -126
- package/.claude/skills/design-system/references/components/skeleton.md +0 -120
- package/.claude/skills/design-system/references/components/slider.md +0 -141
- package/.claude/skills/design-system/references/components/snackbar.md +0 -97
- package/.claude/skills/design-system/references/components/stepper.md +0 -100
- package/.claude/skills/design-system/references/components/steps.md +0 -91
- package/.claude/skills/design-system/references/components/suggest-action.md +0 -95
- package/.claude/skills/design-system/references/components/swipe.md +0 -121
- package/.claude/skills/design-system/references/components/switch.md +0 -98
- package/.claude/skills/design-system/references/components/tab-view.md +0 -120
- package/.claude/skills/design-system/references/components/tag.md +0 -118
- package/.claude/skills/design-system/references/components/text.md +0 -151
- package/.claude/skills/design-system/references/components/toast.md +0 -99
- package/.claude/skills/design-system/references/components/tooltip.md +0 -138
- package/.claude/skills/design-system/references/components/top-nav-miniapp.md +0 -94
- package/.claude/skills/design-system/references/components/top-nav.md +0 -226
- package/.claude/skills/design-system/references/components/uploader.md +0 -115
- package/.claude/skills/design-system/references/navigation/bottom-tab.md +0 -131
- package/.claude/skills/design-system/references/navigation/bottomsheet.md +0 -161
- package/.claude/skills/design-system/references/navigation/modal.md +0 -133
- package/.claude/skills/design-system/references/navigation/navigation-options.md +0 -225
- package/.claude/skills/design-system/references/navigation/navigator.md +0 -111
- package/.claude/skills/design-system/references/navigation/setup.md +0 -134
- package/.claude/skills/design-system/references/navigation/stack.md +0 -128
- package/.claude/skills/design-system/references/spec-convention.md +0 -80
- package/.claude/skills/design-system/references/tokens/colors.md +0 -131
- package/.claude/skills/design-system/references/tokens/spacing-radius.md +0 -144
- package/.claude/skills/design-system/references/tokens/theme.md +0 -125
- package/.claude/skills/design-system/references/tokens/typography.md +0 -135
- package/.claude/skills/design-system-kits/SKILL.md +0 -102
- package/.claude/skills/design-system-kits/references/code-convention.md +0 -118
- package/.claude/skills/design-system-kits/references/components/avatar.md +0 -45
- package/.claude/skills/design-system-kits/references/components/badge.md +0 -27
- package/.claude/skills/design-system-kits/references/components/button.md +0 -65
- package/.claude/skills/design-system-kits/references/components/carousel.md +0 -51
- package/.claude/skills/design-system-kits/references/components/checkbox.md +0 -39
- package/.claude/skills/design-system-kits/references/components/chip.md +0 -54
- package/.claude/skills/design-system-kits/references/components/collapse.md +0 -63
- package/.claude/skills/design-system-kits/references/components/date-picker.md +0 -36
- package/.claude/skills/design-system-kits/references/components/divider.md +0 -21
- package/.claude/skills/design-system-kits/references/components/icon.md +0 -382
- package/.claude/skills/design-system-kits/references/components/image.md +0 -62
- package/.claude/skills/design-system-kits/references/components/information.md +0 -61
- package/.claude/skills/design-system-kits/references/components/input-dropdown.md +0 -92
- package/.claude/skills/design-system-kits/references/components/input-money.md +0 -128
- package/.claude/skills/design-system-kits/references/components/input-otp.md +0 -85
- package/.claude/skills/design-system-kits/references/components/input-phone-number.md +0 -96
- package/.claude/skills/design-system-kits/references/components/input-search.md +0 -127
- package/.claude/skills/design-system-kits/references/components/input-text-area.md +0 -100
- package/.claude/skills/design-system-kits/references/components/input.md +0 -126
- package/.claude/skills/design-system-kits/references/components/loader.md +0 -41
- package/.claude/skills/design-system-kits/references/components/pagination.md +0 -47
- package/.claude/skills/design-system-kits/references/components/popup-notify.md +0 -69
- package/.claude/skills/design-system-kits/references/components/popup-promotion.md +0 -35
- package/.claude/skills/design-system-kits/references/components/progress-info.md +0 -55
- package/.claude/skills/design-system-kits/references/components/radio.md +0 -42
- package/.claude/skills/design-system-kits/references/components/rating.md +0 -36
- package/.claude/skills/design-system-kits/references/components/skeleton.md +0 -25
- package/.claude/skills/design-system-kits/references/components/slider.md +0 -53
- package/.claude/skills/design-system-kits/references/components/snackbar.md +0 -52
- package/.claude/skills/design-system-kits/references/components/stepper.md +0 -46
- package/.claude/skills/design-system-kits/references/components/steps.md +0 -57
- package/.claude/skills/design-system-kits/references/components/suggest-action.md +0 -44
- package/.claude/skills/design-system-kits/references/components/swipe.md +0 -44
- package/.claude/skills/design-system-kits/references/components/switch.md +0 -43
- package/.claude/skills/design-system-kits/references/components/tab-view.md +0 -56
- package/.claude/skills/design-system-kits/references/components/tag.md +0 -50
- package/.claude/skills/design-system-kits/references/components/text.md +0 -56
- package/.claude/skills/design-system-kits/references/components/toast.md +0 -51
- package/.claude/skills/design-system-kits/references/components/tooltip.md +0 -95
- package/.claude/skills/design-system-kits/references/components/uploader.md +0 -48
- package/.claude/skills/design-system-kits/references/design-spec-structure.md +0 -356
- package/.claude/skills/design-system-kits/references/design-spec-to-code.md +0 -596
- package/.claude/skills/design-system-kits/references/navigation/bottom-tab.md +0 -155
- package/.claude/skills/design-system-kits/references/navigation/bottomsheet.md +0 -94
- package/.claude/skills/design-system-kits/references/navigation/modal.md +0 -125
- package/.claude/skills/design-system-kits/references/navigation/navigation-options.md +0 -430
- package/.claude/skills/design-system-kits/references/navigation/navigator.md +0 -177
- package/.claude/skills/design-system-kits/references/navigation/setup.md +0 -94
- package/.claude/skills/design-system-kits/references/navigation/stack.md +0 -152
- package/.claude/skills/design-system-kits/references/screen-layout-rule.md +0 -125
- package/.claude/skills/design-system-kits/references/tokens/colors.md +0 -183
- package/.claude/skills/design-system-kits/references/tokens/spacing-radius.md +0 -45
- package/.claude/skills/design-system-kits/references/tokens/theme.md +0 -97
- package/.claude/skills/design-system-kits/references/tokens/typography.md +0 -105
- package/.claude/skills/vibe-design/SKILL.md +0 -306
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
package vn.momo.kits.navigation
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.Animatable
|
|
4
|
+
import androidx.compose.animation.core.CubicBezierEasing
|
|
5
|
+
import androidx.compose.animation.core.tween
|
|
6
|
+
import androidx.compose.foundation.background
|
|
7
|
+
import androidx.compose.foundation.border
|
|
8
|
+
import androidx.compose.foundation.gestures.detectDragGestures
|
|
9
|
+
import androidx.compose.foundation.layout.Box
|
|
10
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
11
|
+
import androidx.compose.foundation.layout.Column
|
|
12
|
+
import androidx.compose.foundation.layout.Row
|
|
13
|
+
import androidx.compose.foundation.layout.Spacer
|
|
14
|
+
import androidx.compose.foundation.layout.fillMaxHeight
|
|
15
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
16
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
17
|
+
import androidx.compose.foundation.layout.height
|
|
18
|
+
import androidx.compose.foundation.layout.heightIn
|
|
19
|
+
import androidx.compose.foundation.layout.offset
|
|
20
|
+
import androidx.compose.foundation.layout.padding
|
|
21
|
+
import androidx.compose.foundation.layout.size
|
|
22
|
+
import androidx.compose.foundation.layout.width
|
|
23
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
24
|
+
import androidx.compose.runtime.Composable
|
|
25
|
+
import androidx.compose.runtime.DisposableEffect
|
|
26
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
27
|
+
import androidx.compose.runtime.remember
|
|
28
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
29
|
+
import androidx.compose.ui.Alignment
|
|
30
|
+
import androidx.compose.ui.Modifier
|
|
31
|
+
import androidx.compose.ui.graphics.Color
|
|
32
|
+
import androidx.compose.ui.input.pointer.pointerInput
|
|
33
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
34
|
+
import androidx.compose.ui.unit.IntOffset
|
|
35
|
+
import androidx.compose.ui.unit.dp
|
|
36
|
+
import kotlinx.coroutines.launch
|
|
37
|
+
import vn.momo.kits.components.Divider
|
|
38
|
+
import vn.momo.kits.components.Icon
|
|
39
|
+
import vn.momo.kits.components.Text
|
|
40
|
+
import vn.momo.kits.const.AppTheme
|
|
41
|
+
import vn.momo.kits.const.Colors
|
|
42
|
+
import vn.momo.kits.const.Radius
|
|
43
|
+
import vn.momo.kits.const.Spacing
|
|
44
|
+
import vn.momo.kits.application.ApplicationContext
|
|
45
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
46
|
+
import vn.momo.kits.const.Typography
|
|
47
|
+
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
48
|
+
import vn.momo.kits.modifier.conditional
|
|
49
|
+
import vn.momo.kits.modifier.noFeedbackClickable
|
|
50
|
+
import vn.momo.kits.platform.BackHandler
|
|
51
|
+
import vn.momo.kits.platform.getScreenHeight
|
|
52
|
+
|
|
53
|
+
@Composable
|
|
54
|
+
internal fun BottomSheet(
|
|
55
|
+
content: @Composable () -> Unit,
|
|
56
|
+
header: BottomHeader,
|
|
57
|
+
isSurface: Boolean = false,
|
|
58
|
+
barrierDismissible: Boolean = true,
|
|
59
|
+
onDismiss: (() -> Unit)?
|
|
60
|
+
) {
|
|
61
|
+
val navigator = LocalNavigator.current
|
|
62
|
+
|
|
63
|
+
val screenHeightDp = getScreenHeight()
|
|
64
|
+
val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
|
|
65
|
+
val sheetOffset = remember { Animatable(screenHeightPx) }
|
|
66
|
+
|
|
67
|
+
val backgroundAlpha = remember { Animatable(0f) }
|
|
68
|
+
val dynamicAlpha = ((1f - (sheetOffset.value / screenHeightPx)).coerceIn(0f, 1f)) * 0.3f
|
|
69
|
+
val alpha = backgroundAlpha.value + dynamicAlpha
|
|
70
|
+
|
|
71
|
+
val sheetCloseOffset = with(LocalDensity.current) { 100.dp.toPx() }
|
|
72
|
+
|
|
73
|
+
val coroutineScope = rememberCoroutineScope()
|
|
74
|
+
|
|
75
|
+
val maxApi = LocalMaxApi.current
|
|
76
|
+
val context = ApplicationContext.current
|
|
77
|
+
|
|
78
|
+
DisposableEffect(Unit) {
|
|
79
|
+
ScreenTracker.trackPopupDisplayed(
|
|
80
|
+
maxApi = maxApi,
|
|
81
|
+
context = context,
|
|
82
|
+
parentScreenName = ScreenTracker.getLastScreenName()
|
|
83
|
+
)
|
|
84
|
+
onDispose { }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
suspend fun openEvent(){
|
|
88
|
+
backgroundAlpha.animateTo(
|
|
89
|
+
targetValue = 0.3f,
|
|
90
|
+
animationSpec = tween(
|
|
91
|
+
durationMillis = 100,
|
|
92
|
+
easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
sheetOffset.animateTo(
|
|
96
|
+
targetValue = 0f,
|
|
97
|
+
animationSpec = tween(
|
|
98
|
+
durationMillis = 350,
|
|
99
|
+
easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
fun closeEvent(){
|
|
105
|
+
coroutineScope.launch {
|
|
106
|
+
sheetOffset.animateTo(
|
|
107
|
+
targetValue = screenHeightPx,
|
|
108
|
+
animationSpec = tween(
|
|
109
|
+
durationMillis = 200,
|
|
110
|
+
easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
backgroundAlpha.animateTo(
|
|
114
|
+
targetValue = 0f,
|
|
115
|
+
animationSpec = tween(
|
|
116
|
+
durationMillis = 100,
|
|
117
|
+
easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
navigator.pop()
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
LaunchedEffect(Unit) {
|
|
125
|
+
openEvent()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
DisposableEffect(Unit) {
|
|
129
|
+
OverplayComponentRegistry.bindClose { closeEvent() }
|
|
130
|
+
onDispose {
|
|
131
|
+
onDismiss?.invoke()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
BackHandler(true){
|
|
136
|
+
closeEvent()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
BoxWithConstraints(
|
|
140
|
+
modifier = Modifier
|
|
141
|
+
.fillMaxSize()
|
|
142
|
+
.background(Color.Black.copy(alpha = alpha))
|
|
143
|
+
.noFeedbackClickable {
|
|
144
|
+
if(barrierDismissible) closeEvent()
|
|
145
|
+
}
|
|
146
|
+
) {
|
|
147
|
+
val parentHeight = with(LocalDensity.current) { constraints.maxHeight.toDp() }
|
|
148
|
+
|
|
149
|
+
Box(
|
|
150
|
+
modifier = Modifier
|
|
151
|
+
.align(Alignment.BottomCenter)
|
|
152
|
+
.offset { IntOffset(x = 0, y = sheetOffset.value.toInt()) }
|
|
153
|
+
.fillMaxWidth()
|
|
154
|
+
.heightIn(max = parentHeight - 90.dp)
|
|
155
|
+
.background(
|
|
156
|
+
color = if (isSurface) AppTheme.current.colors.background.surface else AppTheme.current.colors.background.default,
|
|
157
|
+
shape = RoundedCornerShape(topStart = Radius.M, topEnd = Radius.M)
|
|
158
|
+
)
|
|
159
|
+
.conditional(IsShowBaseLineDebug) {
|
|
160
|
+
border(1.dp, Colors.blue_03)
|
|
161
|
+
}
|
|
162
|
+
.noFeedbackClickable { },
|
|
163
|
+
contentAlignment = Alignment.BottomCenter
|
|
164
|
+
) {
|
|
165
|
+
Column {
|
|
166
|
+
Box(
|
|
167
|
+
modifier = Modifier
|
|
168
|
+
.height(72.dp)
|
|
169
|
+
.fillMaxWidth()
|
|
170
|
+
.pointerInput(Unit) {
|
|
171
|
+
detectDragGestures(
|
|
172
|
+
onDrag = { change, dragAmount ->
|
|
173
|
+
change.consume()
|
|
174
|
+
coroutineScope.launch {
|
|
175
|
+
val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
|
|
176
|
+
sheetOffset.snapTo(newOffset)
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
onDragEnd = {
|
|
180
|
+
coroutineScope.launch {
|
|
181
|
+
if (sheetOffset.value > sheetCloseOffset) {
|
|
182
|
+
closeEvent()
|
|
183
|
+
} else {
|
|
184
|
+
sheetOffset.animateTo(0f)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
) {
|
|
191
|
+
Column(
|
|
192
|
+
modifier = Modifier
|
|
193
|
+
.fillMaxSize()
|
|
194
|
+
.padding(horizontal = Spacing.M),
|
|
195
|
+
horizontalAlignment = Alignment.CenterHorizontally
|
|
196
|
+
) {
|
|
197
|
+
Spacer(Modifier.height(8.dp))
|
|
198
|
+
Box(
|
|
199
|
+
modifier = Modifier
|
|
200
|
+
.height(4.dp)
|
|
201
|
+
.width(40.dp)
|
|
202
|
+
.background(
|
|
203
|
+
color = Colors.black_06,
|
|
204
|
+
shape = RoundedCornerShape(Radius.S)
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
Spacer(Modifier.height(4.dp))
|
|
208
|
+
Box(Modifier.fillMaxWidth().height(56.dp), contentAlignment = Alignment.Center){
|
|
209
|
+
when (header) {
|
|
210
|
+
is BottomHeader.Title -> {
|
|
211
|
+
Row(modifier = Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
|
|
212
|
+
Box(Modifier.size(24.dp))
|
|
213
|
+
Box(Modifier.fillMaxHeight().weight(1f), contentAlignment = Alignment.Center){
|
|
214
|
+
Text(
|
|
215
|
+
text = header.data,
|
|
216
|
+
color = Colors.black_17,
|
|
217
|
+
style = Typography.headerDefaultBold
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
Box(Modifier
|
|
221
|
+
.size(24.dp)
|
|
222
|
+
.noFeedbackClickable {
|
|
223
|
+
closeEvent()
|
|
224
|
+
},
|
|
225
|
+
contentAlignment = Alignment.Center
|
|
226
|
+
){
|
|
227
|
+
Icon(source = "navigation_close")
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
is BottomHeader.Custom -> {
|
|
232
|
+
header.content()
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
Divider()
|
|
239
|
+
content()
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
sealed class BottomHeader {
|
|
246
|
+
data class Title(
|
|
247
|
+
val data: String = "Bottom Sheet Title",
|
|
248
|
+
) : BottomHeader()
|
|
249
|
+
|
|
250
|
+
data class Custom(
|
|
251
|
+
val content: @Composable () -> Unit
|
|
252
|
+
) : BottomHeader()
|
|
253
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
package vn.momo.kits.navigation
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.Animatable
|
|
4
|
+
import androidx.compose.animation.core.CubicBezierEasing
|
|
5
|
+
import androidx.compose.animation.core.tween
|
|
6
|
+
import androidx.compose.foundation.background
|
|
7
|
+
import androidx.compose.foundation.border
|
|
8
|
+
import androidx.compose.foundation.clickable
|
|
9
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
10
|
+
import androidx.compose.foundation.layout.Box
|
|
11
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
12
|
+
import androidx.compose.foundation.layout.wrapContentSize
|
|
13
|
+
import androidx.compose.runtime.Composable
|
|
14
|
+
import androidx.compose.runtime.DisposableEffect
|
|
15
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
16
|
+
import androidx.compose.runtime.remember
|
|
17
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
18
|
+
import androidx.compose.ui.Alignment
|
|
19
|
+
import androidx.compose.ui.Modifier
|
|
20
|
+
import androidx.compose.ui.draw.alpha
|
|
21
|
+
import androidx.compose.ui.draw.scale
|
|
22
|
+
import androidx.compose.ui.graphics.Color
|
|
23
|
+
import androidx.compose.ui.unit.dp
|
|
24
|
+
import kotlinx.coroutines.launch
|
|
25
|
+
import vn.momo.kits.application.ApplicationContext
|
|
26
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
27
|
+
import vn.momo.kits.const.Colors
|
|
28
|
+
import vn.momo.kits.modifier.conditional
|
|
29
|
+
import vn.momo.kits.modifier.noFeedbackClickable
|
|
30
|
+
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
31
|
+
import vn.momo.kits.platform.BackHandler
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
internal fun ModalScreen(
|
|
35
|
+
content: @Composable () -> Unit,
|
|
36
|
+
barrierDismissible: Boolean = true,
|
|
37
|
+
onDismiss: (() -> Unit)? = null
|
|
38
|
+
) {
|
|
39
|
+
val navigator = LocalNavigator.current
|
|
40
|
+
|
|
41
|
+
val alpha = remember { Animatable(0f) }
|
|
42
|
+
val scale = remember { Animatable(0.8f) }
|
|
43
|
+
|
|
44
|
+
val coroutineScope = rememberCoroutineScope()
|
|
45
|
+
|
|
46
|
+
val maxApi = LocalMaxApi.current
|
|
47
|
+
val context = ApplicationContext.current
|
|
48
|
+
|
|
49
|
+
DisposableEffect(Unit) {
|
|
50
|
+
ScreenTracker.trackPopupDisplayed(
|
|
51
|
+
maxApi = maxApi,
|
|
52
|
+
context = context,
|
|
53
|
+
parentScreenName = ScreenTracker.getLastScreenName()
|
|
54
|
+
)
|
|
55
|
+
onDispose { }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fun openEvent() {
|
|
59
|
+
coroutineScope.launch {
|
|
60
|
+
launch {
|
|
61
|
+
alpha.animateTo(
|
|
62
|
+
targetValue = 1f,
|
|
63
|
+
animationSpec = tween(durationMillis = 250)
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
launch {
|
|
67
|
+
scale.animateTo(
|
|
68
|
+
targetValue = 1f,
|
|
69
|
+
animationSpec = tween(
|
|
70
|
+
durationMillis = 250,
|
|
71
|
+
easing = CubicBezierEasing(0.2f, 0.0f, 0f, 1f)
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
fun closeEvent() {
|
|
79
|
+
coroutineScope.launch {
|
|
80
|
+
alpha.animateTo(
|
|
81
|
+
targetValue = 0f,
|
|
82
|
+
animationSpec = tween(durationMillis = 200)
|
|
83
|
+
)
|
|
84
|
+
scale.animateTo(
|
|
85
|
+
targetValue = 0.8f,
|
|
86
|
+
animationSpec = tween(durationMillis = 200)
|
|
87
|
+
)
|
|
88
|
+
navigator.pop()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
LaunchedEffect(Unit) {
|
|
93
|
+
openEvent()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
DisposableEffect(Unit) {
|
|
97
|
+
OverplayComponentRegistry.bindClose { closeEvent() }
|
|
98
|
+
onDispose {
|
|
99
|
+
onDismiss?.invoke()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
BackHandler(enabled = true) {
|
|
104
|
+
closeEvent()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Box(
|
|
108
|
+
modifier = Modifier
|
|
109
|
+
.fillMaxSize()
|
|
110
|
+
.background(Color.Black.copy(alpha = 0.6f * alpha.value))
|
|
111
|
+
.noFeedbackClickable {
|
|
112
|
+
if(barrierDismissible) closeEvent()
|
|
113
|
+
},
|
|
114
|
+
contentAlignment = Alignment.Center
|
|
115
|
+
) {
|
|
116
|
+
Box(
|
|
117
|
+
modifier = Modifier
|
|
118
|
+
.scale(scale.value)
|
|
119
|
+
.alpha(alpha.value)
|
|
120
|
+
.wrapContentSize()
|
|
121
|
+
.conditional(IsShowBaseLineDebug) {
|
|
122
|
+
border(1.dp, Colors.blue_03)
|
|
123
|
+
}
|
|
124
|
+
.clickable(
|
|
125
|
+
indication = null,
|
|
126
|
+
interactionSource = remember { MutableInteractionSource() }
|
|
127
|
+
) {},
|
|
128
|
+
contentAlignment = Alignment.Center
|
|
129
|
+
) {
|
|
130
|
+
content()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package vn.momo.kits.navigation
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.gestures.ScrollableState
|
|
4
|
+
import androidx.compose.runtime.Composable
|
|
5
|
+
import androidx.compose.runtime.Stable
|
|
6
|
+
import androidx.compose.runtime.State
|
|
7
|
+
import androidx.compose.runtime.mutableStateOf
|
|
8
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
9
|
+
import androidx.compose.ui.graphics.Color
|
|
10
|
+
import vn.momo.kits.navigation.bottomtab.setBottomTabOption
|
|
11
|
+
import vn.momo.kits.navigation.component.FloatingButtonProps
|
|
12
|
+
import vn.momo.kits.navigation.component.HeaderBackProps
|
|
13
|
+
import vn.momo.kits.navigation.component.HeaderRight
|
|
14
|
+
import vn.momo.kits.navigation.component.HeaderTitle
|
|
15
|
+
import vn.momo.kits.navigation.component.HeaderType
|
|
16
|
+
|
|
17
|
+
class Navigation(
|
|
18
|
+
val id: Int = -1,
|
|
19
|
+
val bottomTabIndex: Int = -1,
|
|
20
|
+
val initOptions: NavigationOptions? = null
|
|
21
|
+
) {
|
|
22
|
+
private val _options = mutableStateOf(initOptions ?: NavigationOptions())
|
|
23
|
+
val currentOptions: State<NavigationOptions> get() = _options
|
|
24
|
+
val options: NavigationOptions get() = _options.value
|
|
25
|
+
|
|
26
|
+
fun setOptions(
|
|
27
|
+
onBackHandler: (() -> Unit)? = null,
|
|
28
|
+
hiddenBack: Boolean? = null,
|
|
29
|
+
headerBackProps: HeaderBackProps? = null,
|
|
30
|
+
headerTitle: HeaderTitle? = null,
|
|
31
|
+
headerRight: HeaderRight? = null,
|
|
32
|
+
headerType: HeaderType? = null,
|
|
33
|
+
scrollData: ScrollData? = null,
|
|
34
|
+
backgroundColor: Color? = null,
|
|
35
|
+
tintColor: Color? = null,
|
|
36
|
+
footerComponent: (@Composable () -> Unit)? = null,
|
|
37
|
+
floatingButtonProps: FloatingButtonProps? = null,
|
|
38
|
+
keyboardOptions: KeyboardOptions? = null
|
|
39
|
+
) {
|
|
40
|
+
updateOptions(
|
|
41
|
+
options.copy(
|
|
42
|
+
onBackHandler = onBackHandler ?: options.onBackHandler,
|
|
43
|
+
hiddenBack = hiddenBack ?: options.hiddenBack,
|
|
44
|
+
headerBackProps = headerBackProps ?: options.headerBackProps,
|
|
45
|
+
headerTitle = headerTitle ?: options.headerTitle,
|
|
46
|
+
headerRight = headerRight ?: options.headerRight,
|
|
47
|
+
headerType = headerType ?: options.headerType,
|
|
48
|
+
scrollData = scrollData ?: options.scrollData,
|
|
49
|
+
backgroundColor = backgroundColor ?: options.backgroundColor,
|
|
50
|
+
tintColor = tintColor ?: options.tintColor,
|
|
51
|
+
footerComponent = footerComponent ?: options.footerComponent,
|
|
52
|
+
floatingButtonProps = floatingButtonProps ?: options.floatingButtonProps,
|
|
53
|
+
keyboardOptions = keyboardOptions ?: options.keyboardOptions,
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fun setOptions(newOptions: NavigationOptions) {
|
|
59
|
+
updateOptions(newOptions)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private fun updateOptions(updated: NavigationOptions) {
|
|
63
|
+
_options.value = updated
|
|
64
|
+
if (bottomTabIndex != -1) setBottomTabOption(bottomTabIndex, updated)
|
|
65
|
+
if (id != -1) DynamicScreenRegistry.setOptions(id, updated)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
val LocalNavigation = staticCompositionLocalOf<Navigation> {
|
|
70
|
+
error("No NavigationStack provided")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Stable
|
|
74
|
+
data class NavigationOptions(
|
|
75
|
+
val screenName: String? = null,
|
|
76
|
+
val onBackHandler: (() -> Unit)? = null,
|
|
77
|
+
val hiddenBack: Boolean = false,
|
|
78
|
+
val headerBackProps: HeaderBackProps = HeaderBackProps(),
|
|
79
|
+
val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
|
|
80
|
+
val headerRight: HeaderRight = HeaderRight.Toolkit(),
|
|
81
|
+
val headerType: HeaderType = HeaderType.Default(),
|
|
82
|
+
val scrollData: ScrollData = ScrollData(),
|
|
83
|
+
val backgroundColor: Color? = null,
|
|
84
|
+
val tintColor: Color? = null,
|
|
85
|
+
val footerComponent: @Composable (() -> Unit)? = null,
|
|
86
|
+
val floatingButtonProps: FloatingButtonProps? = null,
|
|
87
|
+
val keyboardOptions: KeyboardOptions = KeyboardOptions()
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
data class KeyboardOptions(
|
|
91
|
+
val keyboardShouldPersistTaps: Boolean = false,
|
|
92
|
+
val useAvoidKeyboard: Boolean = true
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
data class ScrollData(
|
|
97
|
+
val scrollable: Boolean = true,
|
|
98
|
+
val scrollState: ScrollableState? = null,
|
|
99
|
+
)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
package vn.momo.kits.navigation
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.tween
|
|
4
|
+
import androidx.compose.animation.fadeIn
|
|
5
|
+
import androidx.compose.animation.slideInHorizontally
|
|
6
|
+
import androidx.compose.animation.slideInVertically
|
|
7
|
+
import androidx.compose.animation.slideOutHorizontally
|
|
8
|
+
import androidx.compose.animation.slideOutVertically
|
|
9
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
10
|
+
import androidx.compose.foundation.layout.asPaddingValues
|
|
11
|
+
import androidx.compose.foundation.layout.systemBars
|
|
12
|
+
import androidx.compose.runtime.Composable
|
|
13
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
14
|
+
import androidx.compose.runtime.DisposableEffect
|
|
15
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
16
|
+
import androidx.compose.runtime.mutableStateOf
|
|
17
|
+
import androidx.compose.runtime.remember
|
|
18
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
19
|
+
import androidx.compose.ui.unit.Dp
|
|
20
|
+
import androidx.compose.ui.unit.dp
|
|
21
|
+
import androidx.navigation.compose.NavHost
|
|
22
|
+
import androidx.navigation.compose.composable
|
|
23
|
+
import androidx.navigation.compose.rememberNavController
|
|
24
|
+
import androidx.navigation.toRoute
|
|
25
|
+
import vn.momo.kits.application.AppConfig
|
|
26
|
+
import vn.momo.kits.application.AppLanguage
|
|
27
|
+
import vn.momo.kits.application.ApplicationContext
|
|
28
|
+
import vn.momo.kits.application.KitConfig
|
|
29
|
+
import vn.momo.kits.application.MiniAppContext
|
|
30
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
31
|
+
import vn.momo.kits.const.AppStatusBar
|
|
32
|
+
import vn.momo.kits.const.AppTheme
|
|
33
|
+
import vn.momo.kits.const.Theme
|
|
34
|
+
import vn.momo.kits.const.ThemeAssets
|
|
35
|
+
import vn.momo.kits.const.defaultTheme
|
|
36
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
37
|
+
import vn.momo.maxapi.IMaxApi
|
|
38
|
+
|
|
39
|
+
@Composable
|
|
40
|
+
fun NavigationContainer(
|
|
41
|
+
initialScreenName: String,
|
|
42
|
+
initialScreen: @Composable () -> Unit,
|
|
43
|
+
options: NavigationOptions? = null,
|
|
44
|
+
initialTheme: Theme = defaultTheme,
|
|
45
|
+
applicationContext: MiniAppContext? = null,
|
|
46
|
+
maxApi: IMaxApi? = null,
|
|
47
|
+
setNavigator: ((Navigator) -> Unit)? = null,
|
|
48
|
+
statusBarHeight: Dp? = null,
|
|
49
|
+
config: KitConfig? = null,
|
|
50
|
+
language: String? = null
|
|
51
|
+
){
|
|
52
|
+
val navController = rememberNavController()
|
|
53
|
+
val navigator = remember { Navigator(navController = navController, maxApi = maxApi) }
|
|
54
|
+
val statusBarHeight = statusBarHeight ?: getAppStatusBarHeight()
|
|
55
|
+
val navigationBarHeight = if (AppNavigationBar.current == 0.dp) {
|
|
56
|
+
WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
57
|
+
} else {
|
|
58
|
+
AppNavigationBar.current
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
val parentContext = ApplicationContext.current
|
|
62
|
+
val mergedContext = MiniAppContext.merge(parentContext, applicationContext)
|
|
63
|
+
|
|
64
|
+
val theme = remember { mutableStateOf(initialTheme) }
|
|
65
|
+
|
|
66
|
+
LaunchedEffect(Unit) {
|
|
67
|
+
val headerBar = config?.headerBar
|
|
68
|
+
if (headerBar != null && theme.value.assets.headerBackground == null) {
|
|
69
|
+
theme.value = theme.value.copy(
|
|
70
|
+
assets = ThemeAssets(
|
|
71
|
+
headerBackground = headerBar
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
val startDestination = DynamicScreenRegistry.register(initialScreenName, initialScreen, options)
|
|
78
|
+
|
|
79
|
+
CompositionLocalProvider(
|
|
80
|
+
LocalNavigator provides navigator,
|
|
81
|
+
LocalMaxApi provides maxApi,
|
|
82
|
+
AppTheme provides theme.value,
|
|
83
|
+
AppStatusBar provides statusBarHeight,
|
|
84
|
+
AppNavigationBar provides navigationBarHeight,
|
|
85
|
+
ApplicationContext provides mergedContext,
|
|
86
|
+
AppConfig provides config,
|
|
87
|
+
AppLanguage provides language,
|
|
88
|
+
) {
|
|
89
|
+
LaunchedEffect(Unit) {
|
|
90
|
+
setNavigator?.invoke(navigator)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
NavHost(navController, startDestination = startDestination) {
|
|
94
|
+
composable<DynamicScreenRoute>(
|
|
95
|
+
enterTransition = {
|
|
96
|
+
slideInHorizontally(
|
|
97
|
+
animationSpec = tween(300),
|
|
98
|
+
initialOffsetX = { it }
|
|
99
|
+
)
|
|
100
|
+
},
|
|
101
|
+
exitTransition = null,
|
|
102
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
103
|
+
popExitTransition = {
|
|
104
|
+
slideOutHorizontally(
|
|
105
|
+
animationSpec = tween(300),
|
|
106
|
+
targetOffsetX = { it }
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
) { backStackEntry ->
|
|
110
|
+
val route = backStackEntry.toRoute<DynamicScreenRoute>()
|
|
111
|
+
val screen = DynamicScreenRegistry.getScreen(route.id)
|
|
112
|
+
|
|
113
|
+
if (screen != null){
|
|
114
|
+
StackScreen(
|
|
115
|
+
id = route.id,
|
|
116
|
+
name = screen.name,
|
|
117
|
+
content = screen.content,
|
|
118
|
+
navigationOptions = screen.options
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
composable<DynamicDialogRoute>(
|
|
124
|
+
enterTransition = {
|
|
125
|
+
slideInVertically (
|
|
126
|
+
animationSpec = tween(300),
|
|
127
|
+
initialOffsetY = { it }
|
|
128
|
+
)
|
|
129
|
+
},
|
|
130
|
+
exitTransition = null,
|
|
131
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
132
|
+
popExitTransition = {
|
|
133
|
+
slideOutVertically (
|
|
134
|
+
animationSpec = tween(300),
|
|
135
|
+
targetOffsetY = { it }
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
) { backStackEntry ->
|
|
139
|
+
val route = backStackEntry.toRoute<DynamicDialogRoute>()
|
|
140
|
+
val screen = DynamicScreenRegistry.getScreen(route.id)
|
|
141
|
+
|
|
142
|
+
if (screen != null){
|
|
143
|
+
StackScreen(
|
|
144
|
+
id = route.id,
|
|
145
|
+
name = screen.name,
|
|
146
|
+
content = screen.content,
|
|
147
|
+
navigationOptions = screen.options
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
DisposableEffect(Unit) {
|
|
155
|
+
onDispose {
|
|
156
|
+
navigator.dispose()
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
162
|
+
error("No MaxApi provided")
|
|
163
|
+
}
|
|
164
|
+
|