@momo-kits/native-kits 0.157.1-skill.3 → 0.157.1-skill.6-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/skills/momo-native-kits-skills/README.md +52 -0
- package/.claude/skills/momo-native-kits-skills/SKILL.md +32 -0
- package/.claude/skills/momo-native-kits-skills/data-display/SKILL.md +42 -0
- package/.claude/skills/momo-native-kits-skills/feedback/SKILL.md +43 -0
- package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/feedback}/references/popup.md +3 -10
- package/.claude/skills/momo-native-kits-skills/form-controls/SKILL.md +42 -0
- package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/form-controls}/references/button.md +2 -3
- package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/form-controls}/references/input.md +3 -7
- package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/form-controls}/references/radio.md +9 -9
- package/.claude/skills/momo-native-kits-skills/layout/SKILL.md +39 -0
- package/.claude/skills/momo-native-kits-skills/navigation/SKILL.md +38 -0
- package/.claude/skills/momo-native-kits-skills/output/test-report.json +12 -0
- package/.claude/skills/momo-native-kits-skills/output/validation-result.json +108 -0
- package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills}/references/constants.md +81 -6
- package/.claude/skills/momo-native-kits-skills/references/design-guidelines.md +130 -0
- package/.claude/skills/momo-native-kits-skills/references/developer/android-compose.md +29 -0
- package/.claude/skills/momo-native-kits-skills/references/developer/code-convention.md +118 -0
- package/.claude/skills/momo-native-kits-skills/references/developer/compose-multiplatform.md +29 -0
- package/.claude/skills/momo-native-kits-skills/scripts/logger.js +63 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/badge.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/bottomtab.js +19 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/button.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/card.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/checkbox.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/chip.js +59 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/divider.js +19 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/global.js +61 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/index.js +54 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/input.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/navigation.js +48 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/popup.js +45 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/radio.js +105 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/skeleton.js +20 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/snackbar.js +32 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/state.js +21 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/switch.js +45 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/text.js +19 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/tooltip.js +45 -0
- package/.claude/skills/momo-native-kits-skills/scripts/rules/trustbanner.js +22 -0
- package/.claude/skills/momo-native-kits-skills/scripts/test-on-device.sh +117 -0
- package/.claude/skills/momo-native-kits-skills/scripts/test-runner.js +167 -0
- package/.claude/skills/momo-native-kits-skills/scripts/validate-kits.js +131 -0
- package/.momo-agent.json +13 -0
- 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/package.json +1 -1
- package/settings.gradle.kts +52 -0
- package/.claude/momo-native-kits-skill/SKILL.md +0 -51
- package/.claude/momo-native-kits-skill/evals/evals.json +0 -95
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.json +0 -20
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.md +0 -13
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/with_skill/outputs/ButtonExample.kt +0 -55
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/without_skill/outputs/ButtonExample.kt +0 -45
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/with_skill/outputs/InputPhoneExample.kt +0 -40
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/without_skill/outputs/InputPhoneExample.kt +0 -42
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/with_skill/outputs/BottomTabExample.kt +0 -236
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/without_skill/outputs/BottomTabExample.kt +0 -152
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/with_skill/outputs/CheckBoxExample.kt +0 -49
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/without_skill/outputs/CheckBoxExample.kt +0 -123
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/with_skill/outputs/DateTimePickerExample.kt +0 -318
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/without_skill/outputs/DateTimePickerExample.kt +0 -330
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/with_skill/outputs/CardExample.kt +0 -124
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/without_skill/outputs/CardExample.kt +0 -71
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/with_skill/outputs/LoginFormExample.kt +0 -134
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/without_skill/outputs/LoginFormExample.kt +0 -199
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +0 -224
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/without_skill/outputs/NavigationContainerExample.kt +0 -225
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/with_skill/outputs/PopupExample.kt +0 -79
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/without_skill/outputs/PopupExample.kt +0 -169
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/eval_metadata.json +0 -6
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +0 -255
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +0 -212
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/with_skill/outputs/SkeletonExample.kt +0 -199
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/without_skill/outputs/SkeletonExample.kt +0 -229
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.json +0 -20
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.md +0 -13
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/eval_metadata.json +0 -22
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/outputs/PrimaryButtonExample.kt +0 -38
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/timing.json +0 -5
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/outputs/PrimaryButtonExample.kt +0 -83
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/timing.json +0 -5
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/eval_metadata.json +0 -22
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +0 -547
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/timing.json +0 -5
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/outputs/MoMoNavigationContainer.kt +0 -519
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/timing.json +0 -5
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/eval_metadata.json +0 -27
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +0 -429
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/timing.json +0 -5
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +0 -353
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/timing.json +0 -5
- package/.claude/settings.local.json +0 -41
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/data-display}/references/badge.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/data-display}/references/chip.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/data-display}/references/skeleton.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/data-display}/references/text.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/feedback}/references/snackbar.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/feedback}/references/tooltip.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/feedback}/references/trustbanner.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/form-controls}/references/checkbox.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/form-controls}/references/switch.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/layout}/references/card.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/layout}/references/divider.md +0 -0
- /package/.claude/{momo-native-kits-skill → skills/momo-native-kits-skills/navigation}/references/navigation.md +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.examples
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.Box
|
|
4
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
5
|
-
import androidx.compose.foundation.layout.padding
|
|
6
|
-
import androidx.compose.foundation.rememberScrollState
|
|
7
|
-
import androidx.compose.foundation.verticalScroll
|
|
8
|
-
import androidx.compose.material3.Text
|
|
9
|
-
import androidx.compose.runtime.Composable
|
|
10
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
11
|
-
import androidx.compose.runtime.getValue
|
|
12
|
-
import androidx.compose.runtime.mutableStateOf
|
|
13
|
-
import androidx.compose.runtime.remember
|
|
14
|
-
import androidx.compose.runtime.setValue
|
|
15
|
-
import androidx.compose.ui.Modifier
|
|
16
|
-
import androidx.compose.ui.unit.dp
|
|
17
|
-
import vn.momo.kits.navigation.LocalNavigation
|
|
18
|
-
import vn.momo.kits.navigation.LocalNavigator
|
|
19
|
-
import vn.momo.kits.navigation.NavigationContainer
|
|
20
|
-
import vn.momo.kits.navigation.NavigationOptions
|
|
21
|
-
import vn.momo.kits.navigation.component.HeaderTitle
|
|
22
|
-
import vn.momo.kits.navigation.component.HeaderType
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* NavigationContainer Example for MoMo App
|
|
26
|
-
*
|
|
27
|
-
* Key Points:
|
|
28
|
-
* - ONE NavigationContainer per Fragment/Activity
|
|
29
|
-
* - Use setOptions in LaunchedEffect(Unit) for dynamic configuration
|
|
30
|
-
* - Use LocalNavigation.current for setOptions
|
|
31
|
-
* - Use LocalNavigator.current for push/pop/present
|
|
32
|
-
*/
|
|
33
|
-
@Composable
|
|
34
|
-
fun NavigationContainerExample() {
|
|
35
|
-
// Single NavigationContainer - root of the app/fragment
|
|
36
|
-
NavigationContainer(
|
|
37
|
-
initialScreen = {
|
|
38
|
-
HomeScreen()
|
|
39
|
-
},
|
|
40
|
-
options = NavigationOptions(
|
|
41
|
-
headerTitle = HeaderTitle.Default("MoMo App"),
|
|
42
|
-
headerType = HeaderType.DEFAULT
|
|
43
|
-
)
|
|
44
|
-
) {
|
|
45
|
-
// All screens are pushed within this container
|
|
46
|
-
// No need to add anything here as initialScreen handles the first screen
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Home Screen - Initial screen in NavigationContainer
|
|
52
|
-
*/
|
|
53
|
-
@Composable
|
|
54
|
-
fun HomeScreen() {
|
|
55
|
-
val navigator = LocalNavigator.current
|
|
56
|
-
val navigation = LocalNavigation.current
|
|
57
|
-
|
|
58
|
-
// Use LaunchedEffect(Unit) for setOptions - NOT in composable root
|
|
59
|
-
LaunchedEffect(Unit) {
|
|
60
|
-
navigation.setOptions(
|
|
61
|
-
headerTitle = HeaderTitle.Default("Trang chủ"),
|
|
62
|
-
headerType = HeaderType.DEFAULT
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Example: Connect scroll state for header animation
|
|
67
|
-
val scrollState = rememberScrollState()
|
|
68
|
-
LaunchedEffect(Unit) {
|
|
69
|
-
navigation.setOptions(
|
|
70
|
-
scrollData = vn.momo.kits.navigation.ScrollData(
|
|
71
|
-
scrollState = scrollState
|
|
72
|
-
)
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
Box(
|
|
77
|
-
modifier = Modifier
|
|
78
|
-
.fillMaxSize()
|
|
79
|
-
.padding(16.dp)
|
|
80
|
-
.verticalScroll(scrollState)
|
|
81
|
-
) {
|
|
82
|
-
// Screen content
|
|
83
|
-
Text("Home Screen Content")
|
|
84
|
-
|
|
85
|
-
// Example: Navigate to another screen
|
|
86
|
-
// val navigator = LocalNavigator.current
|
|
87
|
-
// navigator.push({ DetailScreen() })
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Detail Screen - Pushed from HomeScreen
|
|
93
|
-
*/
|
|
94
|
-
@Composable
|
|
95
|
-
fun DetailScreen() {
|
|
96
|
-
val navigation = LocalNavigation.current
|
|
97
|
-
|
|
98
|
-
LaunchedEffect(Unit) {
|
|
99
|
-
navigation.setOptions(
|
|
100
|
-
headerTitle = HeaderTitle.Default("Chi tiết"),
|
|
101
|
-
headerType = HeaderType.DEFAULT
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
Box(
|
|
106
|
-
modifier = Modifier
|
|
107
|
-
.fillMaxSize()
|
|
108
|
-
.padding(16.dp)
|
|
109
|
-
) {
|
|
110
|
-
Text("Detail Screen Content")
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Example: Using NavigationOptions with push
|
|
116
|
-
*/
|
|
117
|
-
@Composable
|
|
118
|
-
fun PushWithOptionsExample() {
|
|
119
|
-
val navigator = LocalNavigator.current
|
|
120
|
-
|
|
121
|
-
// Push screen with custom options
|
|
122
|
-
navigator.push(
|
|
123
|
-
content = { DetailScreen() },
|
|
124
|
-
options = NavigationOptions(
|
|
125
|
-
headerTitle = HeaderTitle.Default("Custom Header"),
|
|
126
|
-
headerType = HeaderType.Default
|
|
127
|
-
)
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Example: Present modal screen
|
|
133
|
-
*/
|
|
134
|
-
@Composable
|
|
135
|
-
fun PresentModalExample() {
|
|
136
|
-
val navigator = LocalNavigator.current
|
|
137
|
-
|
|
138
|
-
navigator.present {
|
|
139
|
-
ModalScreen()
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Modal Screen - Presented as modal
|
|
145
|
-
*/
|
|
146
|
-
@Composable
|
|
147
|
-
fun ModalScreen() {
|
|
148
|
-
val navigation = LocalNavigation.current
|
|
149
|
-
|
|
150
|
-
LaunchedEffect(Unit) {
|
|
151
|
-
navigation.setOptions(
|
|
152
|
-
headerTitle = HeaderTitle.Default("Modal"),
|
|
153
|
-
headerType = HeaderType.DEFAULT
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
Box(
|
|
158
|
-
modifier = Modifier
|
|
159
|
-
.fillMaxSize()
|
|
160
|
-
.padding(16.dp)
|
|
161
|
-
) {
|
|
162
|
-
Text("Modal Screen")
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Example: Dynamic header title change
|
|
168
|
-
*/
|
|
169
|
-
@Composable
|
|
170
|
-
fun DynamicTitleExample() {
|
|
171
|
-
val navigation = LocalNavigation.current
|
|
172
|
-
var title by remember { mutableStateOf("Initial Title") }
|
|
173
|
-
|
|
174
|
-
LaunchedEffect(Unit) {
|
|
175
|
-
navigation.setOptions(
|
|
176
|
-
headerTitle = HeaderTitle.Default(title)
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// When title changes, call setOptions again
|
|
181
|
-
LaunchedEffect(title) {
|
|
182
|
-
navigation.setOptions(
|
|
183
|
-
headerTitle = HeaderTitle.Default(title)
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
Box(
|
|
188
|
-
modifier = Modifier
|
|
189
|
-
.fillMaxSize()
|
|
190
|
-
.padding(16.dp)
|
|
191
|
-
) {
|
|
192
|
-
Text("Title: $title")
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Example: Extended header with search
|
|
198
|
-
*/
|
|
199
|
-
@Composable
|
|
200
|
-
fun ExtendedHeaderExample() {
|
|
201
|
-
val navigation = LocalNavigation.current
|
|
202
|
-
val searchText = remember { mutableStateOf("") }
|
|
203
|
-
|
|
204
|
-
LaunchedEffect(Unit) {
|
|
205
|
-
navigation.setOptions(
|
|
206
|
-
headerType = HeaderType.Extended(
|
|
207
|
-
useAnimated = true,
|
|
208
|
-
inputSearchProps = vn.momo.kits.navigation.component.InputSearchProps(
|
|
209
|
-
text = searchText,
|
|
210
|
-
placeholder = "Search...",
|
|
211
|
-
onChangeText = { searchText.value = it }
|
|
212
|
-
)
|
|
213
|
-
)
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
Box(
|
|
218
|
-
modifier = Modifier
|
|
219
|
-
.fillMaxSize()
|
|
220
|
-
.padding(16.dp)
|
|
221
|
-
) {
|
|
222
|
-
Text("Search: ${searchText.value}")
|
|
223
|
-
}
|
|
224
|
-
}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
package com.momo.app.navigation
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.Box
|
|
4
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
5
|
-
import androidx.compose.material3.Text
|
|
6
|
-
import androidx.compose.runtime.Composable
|
|
7
|
-
import androidx.compose.ui.Alignment
|
|
8
|
-
import androidx.compose.ui.Modifier
|
|
9
|
-
import androidx.navigation.NavHostController
|
|
10
|
-
import androidx.navigation.compose.NavHost
|
|
11
|
-
import androidx.navigation.compose.composable
|
|
12
|
-
import androidx.navigation.compose.rememberNavController
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* NavigationContainer Example for MoMo App
|
|
16
|
-
*
|
|
17
|
-
* NavigationContainer is part of the Accompanist Navigation library.
|
|
18
|
-
* It provides a declarative navigation pattern for Jetpack Compose apps.
|
|
19
|
-
*
|
|
20
|
-
* Key Pattern:
|
|
21
|
-
* 1. Create a NavHostController using rememberNavController()
|
|
22
|
-
* 2. Wrap your content with NavigationContainer
|
|
23
|
-
* 3. Define navigation destinations using NavHost
|
|
24
|
-
* 4. Use navigate() to move between screens
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
// Define navigation routes
|
|
28
|
-
sealed class Screen(val route: String) {
|
|
29
|
-
object Home : Screen("home")
|
|
30
|
-
object Detail : Screen("detail/{itemId}") {
|
|
31
|
-
fun createRoute(itemId: String) = "detail/$itemId"
|
|
32
|
-
}
|
|
33
|
-
object Profile : Screen("profile")
|
|
34
|
-
object Settings : Screen("settings")
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Main NavigationContainer setup
|
|
39
|
-
* This is the correct pattern for implementing NavigationContainer in MoMo app
|
|
40
|
-
*/
|
|
41
|
-
@Composable
|
|
42
|
-
fun NavigationContainerExample() {
|
|
43
|
-
// Step 1: Create NavHostController
|
|
44
|
-
val navController: NavHostController = rememberNavController()
|
|
45
|
-
|
|
46
|
-
// Step 2: Wrap with NavigationContainer (from Accompanist)
|
|
47
|
-
androidx.compose.material3.Surface(
|
|
48
|
-
modifier = Modifier.fillMaxSize()
|
|
49
|
-
) {
|
|
50
|
-
NavHost(
|
|
51
|
-
navController = navController,
|
|
52
|
-
startDestination = Screen.Home.route
|
|
53
|
-
) {
|
|
54
|
-
// Step 3: Define navigation destinations
|
|
55
|
-
composable(Screen.Home.route) {
|
|
56
|
-
HomeScreen(
|
|
57
|
-
onNavigateToDetail = { itemId ->
|
|
58
|
-
navController.navigate(Screen.Detail.createRoute(itemId))
|
|
59
|
-
},
|
|
60
|
-
onNavigateToProfile = {
|
|
61
|
-
navController.navigate(Screen.Profile.route)
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
composable(Screen.Detail.route) { backStackEntry ->
|
|
67
|
-
val itemId = backStackEntry.arguments?.getString("itemId") ?: ""
|
|
68
|
-
DetailScreen(
|
|
69
|
-
itemId = itemId,
|
|
70
|
-
onNavigateBack = {
|
|
71
|
-
navController.popBackStack()
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
composable(Screen.Profile.route) {
|
|
77
|
-
ProfileScreen(
|
|
78
|
-
onNavigateBack = {
|
|
79
|
-
navController.popBackStack()
|
|
80
|
-
},
|
|
81
|
-
onNavigateToSettings = {
|
|
82
|
-
navController.navigate(Screen.Settings.route)
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
composable(Screen.Settings.route) {
|
|
88
|
-
SettingsScreen(
|
|
89
|
-
onNavigateBack = {
|
|
90
|
-
navController.popBackStack()
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Home Screen
|
|
100
|
-
*/
|
|
101
|
-
@Composable
|
|
102
|
-
fun HomeScreen(
|
|
103
|
-
onNavigateToDetail: (String) -> Unit,
|
|
104
|
-
onNavigateToProfile: () -> Unit
|
|
105
|
-
) {
|
|
106
|
-
Box(
|
|
107
|
-
modifier = Modifier.fillMaxSize(),
|
|
108
|
-
contentAlignment = Alignment.Center
|
|
109
|
-
) {
|
|
110
|
-
Text("Home Screen")
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Detail Screen
|
|
116
|
-
*/
|
|
117
|
-
@Composable
|
|
118
|
-
fun DetailScreen(
|
|
119
|
-
itemId: String,
|
|
120
|
-
onNavigateBack: () -> Unit
|
|
121
|
-
) {
|
|
122
|
-
Box(
|
|
123
|
-
modifier = Modifier.fillMaxSize(),
|
|
124
|
-
contentAlignment = Alignment.Center
|
|
125
|
-
) {
|
|
126
|
-
Text("Detail Screen - Item: $itemId")
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Profile Screen
|
|
132
|
-
*/
|
|
133
|
-
@Composable
|
|
134
|
-
fun ProfileScreen(
|
|
135
|
-
onNavigateBack: () -> Unit,
|
|
136
|
-
onNavigateToSettings: () -> Unit
|
|
137
|
-
) {
|
|
138
|
-
Box(
|
|
139
|
-
modifier = Modifier.fillMaxSize(),
|
|
140
|
-
contentAlignment = Alignment.Center
|
|
141
|
-
) {
|
|
142
|
-
Text("Profile Screen")
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Settings Screen
|
|
148
|
-
*/
|
|
149
|
-
@Composable
|
|
150
|
-
fun SettingsScreen(
|
|
151
|
-
onNavigateBack: () -> Unit
|
|
152
|
-
) {
|
|
153
|
-
Box(
|
|
154
|
-
modifier = Modifier.fillMaxSize(),
|
|
155
|
-
contentAlignment = Alignment.Center
|
|
156
|
-
) {
|
|
157
|
-
Text("Settings Screen")
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Alternative: Using NavigationContainer from Accompanist
|
|
163
|
-
* This provides additional features like deep linking support
|
|
164
|
-
*/
|
|
165
|
-
@Composable
|
|
166
|
-
fun NavigationContainerWithDeepLink() {
|
|
167
|
-
val navController = rememberNavController()
|
|
168
|
-
|
|
169
|
-
androidx.compose.material3.Surface(
|
|
170
|
-
modifier = Modifier.fillMaxSize()
|
|
171
|
-
) {
|
|
172
|
-
NavHost(
|
|
173
|
-
navController = navController,
|
|
174
|
-
startDestination = Screen.Home.route
|
|
175
|
-
) {
|
|
176
|
-
composable(
|
|
177
|
-
route = Screen.Home.route,
|
|
178
|
-
deepLinks = listOf(
|
|
179
|
-
androidx.navigation.navDeepLink {
|
|
180
|
-
uriPattern = "momo://home"
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
) {
|
|
184
|
-
HomeScreen(
|
|
185
|
-
onNavigateToDetail = { itemId ->
|
|
186
|
-
navController.navigate(Screen.Detail.createRoute(itemId))
|
|
187
|
-
},
|
|
188
|
-
onNavigateToProfile = {
|
|
189
|
-
navController.navigate(Screen.Profile.route)
|
|
190
|
-
}
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
composable(
|
|
195
|
-
route = Screen.Detail.route,
|
|
196
|
-
deepLinks = listOf(
|
|
197
|
-
androidx.navigation.navDeepLink {
|
|
198
|
-
uriPattern = "momo://detail/{itemId}"
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
) { backStackEntry ->
|
|
202
|
-
val itemId = backStackEntry.arguments?.getString("itemId") ?: ""
|
|
203
|
-
DetailScreen(
|
|
204
|
-
itemId = itemId,
|
|
205
|
-
onNavigateBack = {
|
|
206
|
-
navController.popBackStack()
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
composable(Screen.Profile.route) {
|
|
212
|
-
ProfileScreen(
|
|
213
|
-
onNavigateBack = { navController.popBackStack() },
|
|
214
|
-
onNavigateToSettings = { navController.navigate(Screen.Settings.route) }
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
composable(Screen.Settings.route) {
|
|
219
|
-
SettingsScreen(
|
|
220
|
-
onNavigateBack = { navController.popBackStack() }
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
package com.example
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.Box
|
|
4
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
5
|
-
import androidx.compose.runtime.Composable
|
|
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.Modifier
|
|
11
|
-
import vn.momo.kits.components.PopupNotify
|
|
12
|
-
import vn.momo.kits.components.PopupNotifyProps
|
|
13
|
-
import vn.momo.kits.components.PopupNotifyType
|
|
14
|
-
import vn.momo.kits.components.PopupAction
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Example: Show a popup notification for success message in MoMo Native Kits
|
|
18
|
-
*
|
|
19
|
-
* This demonstrates how to display a success popup using PopupNotify component
|
|
20
|
-
* with the type SUCCESS to show a green checkmark icon and success styling.
|
|
21
|
-
*/
|
|
22
|
-
@Composable
|
|
23
|
-
fun SuccessPopupExample() {
|
|
24
|
-
var showPopup by remember { mutableStateOf(true) }
|
|
25
|
-
|
|
26
|
-
Box(modifier = Modifier.fillMaxSize()) {
|
|
27
|
-
PopupNotify(
|
|
28
|
-
props = PopupNotifyProps(
|
|
29
|
-
title = "Thành công",
|
|
30
|
-
message = "Giao dịch đã được xử lý thành công!",
|
|
31
|
-
type = PopupNotifyType.SUCCESS,
|
|
32
|
-
onIconClose = { showPopup = false }
|
|
33
|
-
)
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Alternative example: Success popup with action buttons
|
|
40
|
-
*/
|
|
41
|
-
@Composable
|
|
42
|
-
fun SuccessPopupWithActionsExample() {
|
|
43
|
-
var showPopup by remember { mutableStateOf(true) }
|
|
44
|
-
|
|
45
|
-
Box(modifier = Modifier.fillMaxSize()) {
|
|
46
|
-
PopupNotify(
|
|
47
|
-
props = PopupNotifyProps(
|
|
48
|
-
title = "Thành công",
|
|
49
|
-
message = "Bạn đã đăng ký dịch vụ thành công",
|
|
50
|
-
type = PopupNotifyType.SUCCESS,
|
|
51
|
-
primary = PopupAction(
|
|
52
|
-
title = "Xem chi tiết",
|
|
53
|
-
onPress = { /* navigate to details */ }
|
|
54
|
-
),
|
|
55
|
-
secondary = PopupAction(
|
|
56
|
-
title = "Đóng",
|
|
57
|
-
onPress = { showPopup = false }
|
|
58
|
-
),
|
|
59
|
-
onIconClose = { showPopup = false }
|
|
60
|
-
)
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Alternative example: Using SnackBar for success message (lighter weight)
|
|
67
|
-
*
|
|
68
|
-
* SnackBar is better for brief success messages that auto-dismiss,
|
|
69
|
-
* while PopupNotify is better for important messages requiring user attention.
|
|
70
|
-
*/
|
|
71
|
-
@Composable
|
|
72
|
-
fun SuccessSnackBarExample() {
|
|
73
|
-
Box(modifier = Modifier.fillMaxSize()) {
|
|
74
|
-
vn.momo.kits.components.SnackBar(
|
|
75
|
-
message = "Giao dịch thành công",
|
|
76
|
-
duration = vn.momo.kits.components.SnackBarDuration.SHORT
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
package com.momo.example
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.layout.*
|
|
5
|
-
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
6
|
-
import androidx.compose.material3.*
|
|
7
|
-
import androidx.compose.runtime.*
|
|
8
|
-
import androidx.compose.ui.Alignment
|
|
9
|
-
import androidx.compose.ui.Modifier
|
|
10
|
-
import androidx.compose.ui.draw.clip
|
|
11
|
-
import androidx.compose.ui.graphics.Color
|
|
12
|
-
import androidx.compose.ui.text.font.FontWeight
|
|
13
|
-
import androidx.compose.ui.unit.dp
|
|
14
|
-
import androidx.compose.ui.unit.sp
|
|
15
|
-
import androidx.compose.ui.window.Dialog
|
|
16
|
-
import androidx.compose.ui.window.DialogProperties
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* MoMo-style Success Popup Notification Example
|
|
20
|
-
* This demonstrates how to show a popup notification for success messages
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
@Composable
|
|
24
|
-
fun SuccessPopupNotification(
|
|
25
|
-
title: String,
|
|
26
|
-
message: String,
|
|
27
|
-
onDismiss: () -> Unit
|
|
28
|
-
) {
|
|
29
|
-
Dialog(
|
|
30
|
-
onDismissRequest = onDismiss,
|
|
31
|
-
properties = DialogProperties(
|
|
32
|
-
dismissOnBackPress = true,
|
|
33
|
-
dismissOnClickOutside = true
|
|
34
|
-
)
|
|
35
|
-
) {
|
|
36
|
-
Card(
|
|
37
|
-
modifier = Modifier
|
|
38
|
-
.fillMaxWidth()
|
|
39
|
-
.padding(16.dp),
|
|
40
|
-
shape = RoundedCornerShape(16.dp),
|
|
41
|
-
colors = CardDefaults.cardColors(
|
|
42
|
-
containerColor = Color.White
|
|
43
|
-
),
|
|
44
|
-
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
|
|
45
|
-
) {
|
|
46
|
-
Column(
|
|
47
|
-
modifier = Modifier
|
|
48
|
-
.fillMaxWidth()
|
|
49
|
-
.padding(24.dp),
|
|
50
|
-
horizontalAlignment = Alignment.CenterHorizontally
|
|
51
|
-
) {
|
|
52
|
-
// Success Icon
|
|
53
|
-
Box(
|
|
54
|
-
modifier = Modifier
|
|
55
|
-
.size(64.dp)
|
|
56
|
-
.clip(RoundedCornerShape(32.dp))
|
|
57
|
-
.background(Color(0xFF00B859)),
|
|
58
|
-
contentAlignment = Alignment.Center
|
|
59
|
-
) {
|
|
60
|
-
Text(
|
|
61
|
-
text = "✓",
|
|
62
|
-
color = Color.White,
|
|
63
|
-
fontSize = 32.sp,
|
|
64
|
-
fontWeight = FontWeight.Bold
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Spacer(modifier = Modifier.height(16.dp))
|
|
69
|
-
|
|
70
|
-
// Title
|
|
71
|
-
Text(
|
|
72
|
-
text = title,
|
|
73
|
-
fontSize = 20.sp,
|
|
74
|
-
fontWeight = FontWeight.Bold,
|
|
75
|
-
color = Color(0xFF1A1A1A)
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
Spacer(modifier = Modifier.height(8.dp))
|
|
79
|
-
|
|
80
|
-
// Message
|
|
81
|
-
Text(
|
|
82
|
-
text = message,
|
|
83
|
-
fontSize = 14.sp,
|
|
84
|
-
color = Color(0xFF666666),
|
|
85
|
-
modifier = Modifier.padding(horizontal = 8.dp)
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
Spacer(modifier = Modifier.height(24.dp))
|
|
89
|
-
|
|
90
|
-
// Button
|
|
91
|
-
Button(
|
|
92
|
-
onClick = onDismiss,
|
|
93
|
-
modifier = Modifier
|
|
94
|
-
.fillMaxWidth()
|
|
95
|
-
.height(48.dp),
|
|
96
|
-
shape = RoundedCornerShape(24.dp),
|
|
97
|
-
colors = ButtonDefaults.buttonColors(
|
|
98
|
-
containerColor = Color(0xFF00B859)
|
|
99
|
-
)
|
|
100
|
-
) {
|
|
101
|
-
Text(
|
|
102
|
-
text = "OK",
|
|
103
|
-
fontSize = 16.sp,
|
|
104
|
-
fontWeight = FontWeight.SemiBold
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Simpler Snackbar-style success message
|
|
114
|
-
* Can be used with Scaffold and SnackbarHost
|
|
115
|
-
*/
|
|
116
|
-
@Composable
|
|
117
|
-
fun SuccessSnackbar(
|
|
118
|
-
message: String,
|
|
119
|
-
snackbarHostState: SnackbarHostState
|
|
120
|
-
) {
|
|
121
|
-
LaunchedEffect(message) {
|
|
122
|
-
snackbarHostState.showSnackbar(
|
|
123
|
-
message = message,
|
|
124
|
-
duration = SnackbarDuration.Short
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Example usage in a Composable
|
|
131
|
-
*/
|
|
132
|
-
@Composable
|
|
133
|
-
fun PopupExampleScreen() {
|
|
134
|
-
var showSuccessPopup by remember { mutableStateOf(false) }
|
|
135
|
-
val snackbarHostState = remember { SnackbarHostState() }
|
|
136
|
-
|
|
137
|
-
Box(
|
|
138
|
-
modifier = Modifier.fillMaxSize(),
|
|
139
|
-
contentAlignment = Alignment.Center
|
|
140
|
-
) {
|
|
141
|
-
Button(
|
|
142
|
-
onClick = { showSuccessPopup = true },
|
|
143
|
-
colors = ButtonDefaults.buttonColors(
|
|
144
|
-
containerColor = Color(0xFF00B859)
|
|
145
|
-
)
|
|
146
|
-
) {
|
|
147
|
-
Text("Show Success Popup")
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (showSuccessPopup) {
|
|
152
|
-
SuccessPopupNotification(
|
|
153
|
-
title = "Success!",
|
|
154
|
-
message = "Your transaction has been completed successfully.",
|
|
155
|
-
onDismiss = { showSuccessPopup = false }
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Alternative: Toast-style notification (for background operations)
|
|
162
|
-
* This is typically shown using Android Toast API
|
|
163
|
-
*/
|
|
164
|
-
@Composable
|
|
165
|
-
fun ShowSuccessToast(message: String) {
|
|
166
|
-
// In actual implementation, this would call Android Toast
|
|
167
|
-
// Example:
|
|
168
|
-
// Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
|
|
169
|
-
}
|