@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,429 @@
|
|
|
1
|
+
package vn.momo.kits.navigation.examples
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.Column
|
|
6
|
+
import androidx.compose.foundation.layout.Spacer
|
|
7
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
8
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
9
|
+
import androidx.compose.foundation.layout.height
|
|
10
|
+
import androidx.compose.foundation.layout.padding
|
|
11
|
+
import androidx.compose.foundation.rememberScrollState
|
|
12
|
+
import androidx.compose.foundation.verticalScroll
|
|
13
|
+
import androidx.compose.material3.MaterialTheme
|
|
14
|
+
import androidx.compose.material3.Text
|
|
15
|
+
import androidx.compose.runtime.Composable
|
|
16
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
17
|
+
import androidx.compose.runtime.getValue
|
|
18
|
+
import androidx.compose.runtime.mutableStateOf
|
|
19
|
+
import androidx.compose.runtime.remember
|
|
20
|
+
import androidx.compose.runtime.setValue
|
|
21
|
+
import androidx.compose.ui.Modifier
|
|
22
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
23
|
+
import androidx.compose.ui.unit.dp
|
|
24
|
+
import vn.momo.kits.components.Button
|
|
25
|
+
import vn.momo.kits.components.ButtonType
|
|
26
|
+
import vn.momo.kits.components.Input
|
|
27
|
+
import vn.momo.kits.components.Size
|
|
28
|
+
import vn.momo.kits.navigation.LocalNavigation
|
|
29
|
+
import vn.momo.kits.navigation.LocalNavigator
|
|
30
|
+
import vn.momo.kits.navigation.NavigationContainer
|
|
31
|
+
import vn.momo.kits.navigation.NavigationOptions
|
|
32
|
+
import vn.momo.kits.navigation.component.HeaderTitle
|
|
33
|
+
import vn.momo.kits.navigation.component.HeaderType
|
|
34
|
+
import vn.momo.kits.navigation.component.ScrollData
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* SetOptionsExample - Demonstrates how to use setOptions in MoMo Navigation
|
|
38
|
+
* to change header title dynamically.
|
|
39
|
+
*
|
|
40
|
+
* KEY CONCEPTS:
|
|
41
|
+
* - LocalNavigation.current provides access to setOptions for configuring screen header
|
|
42
|
+
* - Call setOptions inside LaunchedEffect(Unit) for initial screen configuration
|
|
43
|
+
* - Call setOptions from any user action handler to update header dynamically
|
|
44
|
+
* - HeaderTitle.Default("Your Title") is used to set the header text
|
|
45
|
+
*
|
|
46
|
+
* USAGE:
|
|
47
|
+
* 1. Access navigation: val navigation = LocalNavigation.current
|
|
48
|
+
* 2. Set initial options in LaunchedEffect(Unit) when screen loads
|
|
49
|
+
* 3. Update dynamically: navigation.setOptions(headerTitle = HeaderTitle.Default("New Title"))
|
|
50
|
+
*
|
|
51
|
+
* This example shows practical use cases for dynamic header title changes in a real app scenario.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Main entry point showing the NavigationContainer with the SetOptionsDemoScreen
|
|
56
|
+
*/
|
|
57
|
+
@Composable
|
|
58
|
+
fun SetOptionsNavigationExample() {
|
|
59
|
+
NavigationContainer(
|
|
60
|
+
initialScreen = {
|
|
61
|
+
SetOptionsDemoScreen()
|
|
62
|
+
},
|
|
63
|
+
options = NavigationOptions(
|
|
64
|
+
headerTitle = HeaderTitle.Default("MoMo Navigation"),
|
|
65
|
+
headerType = HeaderType.Default
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Demo screen that showcases various setOptions use cases for dynamic header title changes
|
|
72
|
+
*/
|
|
73
|
+
@Composable
|
|
74
|
+
fun SetOptionsDemoScreen() {
|
|
75
|
+
val navigation = LocalNavigation.current
|
|
76
|
+
val navigator = LocalNavigator.current
|
|
77
|
+
|
|
78
|
+
// State for dynamic title input
|
|
79
|
+
var titleInput by remember { mutableStateOf("") }
|
|
80
|
+
|
|
81
|
+
// State to track current title (for demonstration)
|
|
82
|
+
var currentTitle by remember { mutableStateOf("SetOptions Demo") }
|
|
83
|
+
|
|
84
|
+
// Set initial options when screen loads
|
|
85
|
+
LaunchedEffect(Unit) {
|
|
86
|
+
navigation.setOptions(
|
|
87
|
+
headerTitle = HeaderTitle.Default(currentTitle),
|
|
88
|
+
headerType = HeaderType.Default
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Column(
|
|
93
|
+
modifier = Modifier
|
|
94
|
+
.fillMaxSize()
|
|
95
|
+
.padding(16.dp)
|
|
96
|
+
.verticalScroll(rememberScrollState()),
|
|
97
|
+
verticalArrangement = Arrangement.spacedBy(16.dp)
|
|
98
|
+
) {
|
|
99
|
+
// Header
|
|
100
|
+
Text(
|
|
101
|
+
text = "How to Use setOptions",
|
|
102
|
+
style = MaterialTheme.typography.headlineSmall,
|
|
103
|
+
modifier = Modifier.fillMaxWidth(),
|
|
104
|
+
textAlign = TextAlign.Center
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
Text(
|
|
108
|
+
text = "Learn how to change header title dynamically using setOptions in MoMo Navigation",
|
|
109
|
+
style = MaterialTheme.typography.bodyMedium,
|
|
110
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
114
|
+
|
|
115
|
+
// ========================================
|
|
116
|
+
// Example 1: Dynamic Title from User Input
|
|
117
|
+
// ========================================
|
|
118
|
+
SectionHeader(title = "1. Change Title from Input")
|
|
119
|
+
|
|
120
|
+
Text(
|
|
121
|
+
text = "Enter a custom title and apply it to the header",
|
|
122
|
+
style = MaterialTheme.typography.bodySmall,
|
|
123
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
Input(
|
|
127
|
+
text = titleInput,
|
|
128
|
+
onChangeText = { titleInput = it },
|
|
129
|
+
placeholder = "Enter title here...",
|
|
130
|
+
modifier = Modifier.fillMaxWidth()
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
Button(
|
|
134
|
+
title = "Apply Title",
|
|
135
|
+
onClick = {
|
|
136
|
+
if (titleInput.isNotBlank()) {
|
|
137
|
+
currentTitle = titleInput
|
|
138
|
+
navigation.setOptions(
|
|
139
|
+
headerTitle = HeaderTitle.Default(titleInput)
|
|
140
|
+
)
|
|
141
|
+
titleInput = "" // Clear input after applying
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
type = ButtonType.PRIMARY,
|
|
145
|
+
size = Size.MEDIUM,
|
|
146
|
+
modifier = Modifier.fillMaxWidth()
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
150
|
+
|
|
151
|
+
// ========================================
|
|
152
|
+
// Example 2: Quick Title Presets
|
|
153
|
+
// ========================================
|
|
154
|
+
SectionHeader(title = "2. Quick Title Presets")
|
|
155
|
+
|
|
156
|
+
Text(
|
|
157
|
+
text = "Common titles used in MoMo app",
|
|
158
|
+
style = MaterialTheme.typography.bodySmall,
|
|
159
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
// Row of preset buttons
|
|
163
|
+
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
|
164
|
+
RowPresetButtons(
|
|
165
|
+
presets = listOf("Home", "Profile", "Wallet"),
|
|
166
|
+
onPresetClick = { preset ->
|
|
167
|
+
currentTitle = preset
|
|
168
|
+
navigation.setOptions(
|
|
169
|
+
headerTitle = HeaderTitle.Default(preset)
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
RowPresetButtons(
|
|
175
|
+
presets = listOf("Settings", "Notifications", "History"),
|
|
176
|
+
onPresetClick = { preset ->
|
|
177
|
+
currentTitle = preset
|
|
178
|
+
navigation.setOptions(
|
|
179
|
+
headerTitle = HeaderTitle.Default(preset)
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
186
|
+
|
|
187
|
+
// ========================================
|
|
188
|
+
// Example 3: Context-Aware Title Changes
|
|
189
|
+
// ========================================
|
|
190
|
+
SectionHeader(title = "3. Context-Aware Titles")
|
|
191
|
+
|
|
192
|
+
Text(
|
|
193
|
+
text = "Real-world scenario: Title changes based on user selection",
|
|
194
|
+
style = MaterialTheme.typography.bodySmall,
|
|
195
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
// Simulate category selection
|
|
199
|
+
var selectedCategory by remember { mutableStateOf("All") }
|
|
200
|
+
val categories = listOf("All", "Electronics", "Fashion", "Food", "Travel")
|
|
201
|
+
|
|
202
|
+
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
|
203
|
+
categories.forEach { category ->
|
|
204
|
+
CategoryButton(
|
|
205
|
+
title = category,
|
|
206
|
+
isSelected = selectedCategory == category,
|
|
207
|
+
onClick = {
|
|
208
|
+
selectedCategory = category
|
|
209
|
+
val displayTitle = if (category == "All") "Products" else "Products - $category"
|
|
210
|
+
navigation.setOptions(
|
|
211
|
+
headerTitle = HeaderTitle.Default(displayTitle)
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
219
|
+
|
|
220
|
+
// ========================================
|
|
221
|
+
// Example 4: Header Type Changes
|
|
222
|
+
// ========================================
|
|
223
|
+
SectionHeader(title = "4. Change Header Type")
|
|
224
|
+
|
|
225
|
+
Text(
|
|
226
|
+
text = "You can also change header type dynamically",
|
|
227
|
+
style = MaterialTheme.typography.bodySmall,
|
|
228
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
Button(
|
|
232
|
+
title = "Hide Header",
|
|
233
|
+
onClick = {
|
|
234
|
+
navigation.setOptions(
|
|
235
|
+
headerType = HeaderType.None
|
|
236
|
+
)
|
|
237
|
+
},
|
|
238
|
+
type = ButtonType.OUTLINE,
|
|
239
|
+
size = Size.MEDIUM,
|
|
240
|
+
modifier = Modifier.fillMaxWidth()
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
Button(
|
|
244
|
+
title = "Show Default Header",
|
|
245
|
+
onClick = {
|
|
246
|
+
navigation.setOptions(
|
|
247
|
+
headerType = HeaderType.Default,
|
|
248
|
+
headerTitle = HeaderTitle.Default(currentTitle)
|
|
249
|
+
)
|
|
250
|
+
},
|
|
251
|
+
type = ButtonType.OUTLINE,
|
|
252
|
+
size = Size.MEDIUM,
|
|
253
|
+
modifier = Modifier.fillMaxWidth()
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
257
|
+
|
|
258
|
+
// ========================================
|
|
259
|
+
// Example 5: Navigation with Options
|
|
260
|
+
// ========================================
|
|
261
|
+
SectionHeader(title = "5. Push Screen with Options")
|
|
262
|
+
|
|
263
|
+
Text(
|
|
264
|
+
text = "Pass options when navigating to a new screen",
|
|
265
|
+
style = MaterialTheme.typography.bodySmall,
|
|
266
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
Button(
|
|
270
|
+
title = "Go to Detail Screen",
|
|
271
|
+
onClick = {
|
|
272
|
+
navigator.push(
|
|
273
|
+
content = { DetailScreen() },
|
|
274
|
+
options = NavigationOptions(
|
|
275
|
+
headerTitle = HeaderTitle.Default("Product Details")
|
|
276
|
+
)
|
|
277
|
+
)
|
|
278
|
+
},
|
|
279
|
+
type = ButtonType.TONAL,
|
|
280
|
+
size = Size.MEDIUM,
|
|
281
|
+
modifier = Modifier.fillMaxWidth()
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
Spacer(modifier = Modifier.height(24.dp))
|
|
285
|
+
|
|
286
|
+
// ========================================
|
|
287
|
+
// Summary
|
|
288
|
+
// ========================================
|
|
289
|
+
Text(
|
|
290
|
+
text = "Summary",
|
|
291
|
+
style = MaterialTheme.typography.titleMedium
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
Text(
|
|
295
|
+
text = """
|
|
296
|
+
To change header title dynamically with setOptions:
|
|
297
|
+
|
|
298
|
+
1. Get navigation instance: val navigation = LocalNavigation.current
|
|
299
|
+
|
|
300
|
+
2. Call setOptions() with HeaderTitle.Default("Your Title")
|
|
301
|
+
|
|
302
|
+
3. Use LaunchedEffect(Unit) for initial setup:
|
|
303
|
+
LaunchedEffect(Unit) {
|
|
304
|
+
navigation.setOptions(
|
|
305
|
+
headerTitle = HeaderTitle.Default("Initial Title")
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
4. Call from any event handler for dynamic updates:
|
|
310
|
+
Button(onClick = {
|
|
311
|
+
navigation.setOptions(
|
|
312
|
+
headerTitle = HeaderTitle.Default("New Title")
|
|
313
|
+
)
|
|
314
|
+
})
|
|
315
|
+
""".trimIndent(),
|
|
316
|
+
style = MaterialTheme.typography.bodySmall,
|
|
317
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Detail screen pushed from the main demo
|
|
324
|
+
* Shows that setOptions works on pushed screens too
|
|
325
|
+
*/
|
|
326
|
+
@Composable
|
|
327
|
+
fun DetailScreen() {
|
|
328
|
+
val navigation = LocalNavigation.current
|
|
329
|
+
|
|
330
|
+
// Set options when this screen loads
|
|
331
|
+
LaunchedEffect(Unit) {
|
|
332
|
+
navigation.setOptions(
|
|
333
|
+
headerTitle = HeaderTitle.Default("Product Details"),
|
|
334
|
+
scrollData = ScrollData(scrollState = rememberScrollState())
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
Column(
|
|
339
|
+
modifier = Modifier
|
|
340
|
+
.fillMaxSize()
|
|
341
|
+
.padding(16.dp)
|
|
342
|
+
.verticalScroll(rememberScrollState()),
|
|
343
|
+
verticalArrangement = Arrangement.spacedBy(16.dp)
|
|
344
|
+
) {
|
|
345
|
+
Text(
|
|
346
|
+
text = "Product Details",
|
|
347
|
+
style = MaterialTheme.typography.headlineMedium
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
Text(
|
|
351
|
+
text = "This is a detail screen pushed with NavigationOptions. " +
|
|
352
|
+
"The header title was set when pushing this screen.",
|
|
353
|
+
style = MaterialTheme.typography.bodyMedium
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
Text(
|
|
357
|
+
text = "You can also change the title dynamically from this screen:",
|
|
358
|
+
style = MaterialTheme.typography.bodyMedium
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
Button(
|
|
362
|
+
title = "Update to 'Item Details'",
|
|
363
|
+
onClick = {
|
|
364
|
+
navigation.setOptions(
|
|
365
|
+
headerTitle = HeaderTitle.Default("Item Details")
|
|
366
|
+
)
|
|
367
|
+
},
|
|
368
|
+
type = ButtonType.PRIMARY,
|
|
369
|
+
size = Size.MEDIUM
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
Button(
|
|
373
|
+
title = "Update to 'Product #12345'",
|
|
374
|
+
onClick = {
|
|
375
|
+
navigation.setOptions(
|
|
376
|
+
headerTitle = HeaderTitle.Default("Product #12345")
|
|
377
|
+
)
|
|
378
|
+
},
|
|
379
|
+
type = ButtonType.SECONDARY,
|
|
380
|
+
size = Size.MEDIUM
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// ========================================
|
|
386
|
+
// Helper Components
|
|
387
|
+
// ========================================
|
|
388
|
+
|
|
389
|
+
@Composable
|
|
390
|
+
private fun SectionHeader(title: String) {
|
|
391
|
+
Text(
|
|
392
|
+
text = title,
|
|
393
|
+
style = MaterialTheme.typography.titleMedium,
|
|
394
|
+
color = MaterialTheme.colorScheme.primary
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@Composable
|
|
399
|
+
private fun RowPresetButtons(
|
|
400
|
+
presets: List<String>,
|
|
401
|
+
onPresetClick: (String) -> Unit
|
|
402
|
+
) {
|
|
403
|
+
Box(
|
|
404
|
+
modifier = Modifier.fillMaxWidth()
|
|
405
|
+
) {
|
|
406
|
+
// Display presets as a text list for simplicity
|
|
407
|
+
// In real app, these would be chip or button components
|
|
408
|
+
Text(
|
|
409
|
+
text = presets.joinToString(" | "),
|
|
410
|
+
style = MaterialTheme.typography.bodyMedium,
|
|
411
|
+
modifier = Modifier.padding(vertical = 8.dp)
|
|
412
|
+
)
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@Composable
|
|
417
|
+
private fun CategoryButton(
|
|
418
|
+
title: String,
|
|
419
|
+
isSelected: Boolean,
|
|
420
|
+
onClick: () -> Unit
|
|
421
|
+
) {
|
|
422
|
+
Button(
|
|
423
|
+
title = title,
|
|
424
|
+
onClick = onClick,
|
|
425
|
+
type = if (isSelected) ButtonType.PRIMARY else ButtonType.OUTLINE,
|
|
426
|
+
size = Size.SMALL,
|
|
427
|
+
modifier = Modifier.fillMaxWidth()
|
|
428
|
+
)
|
|
429
|
+
}
|