Skip to content

Commit

Permalink
#310 [ui] navigate Represent Rule Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Sep 2, 2023
1 parent eeeb491 commit a57c596
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fun MainRuleContent(
onSearch: (String) -> Unit = {},
onOpenDetailRule: (Int) -> Unit = {},
onNavigateToAddRule: () -> Unit = {},
onNavigateToRepresentRule: () -> Unit = {},
onFinish: () -> Unit = {}
) {
val focusManager = LocalFocusManager.current
Expand All @@ -42,7 +43,8 @@ fun MainRuleContent(
.padding(
start = 16.dp,
end = 16.dp
).pointerInput(Unit) {
)
.pointerInput(Unit) {
detectTapGestures(
onTap = {
focusManager.clearFocus()
Expand All @@ -52,7 +54,8 @@ fun MainRuleContent(
horizontalAlignment = Alignment.CenterHorizontally
) {
MainRuleToolbar(
onBack = onFinish
onBack = onFinish,
onNavigateToRepresentRule = onNavigateToRepresentRule
)
Spacer(modifier = Modifier.padding(top = 4.dp))
HousTextField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import hous.release.designsystem.theme.HousTheme

@Composable
fun MainRuleToolbar(
onClickSetting: () -> Unit = {},
onNavigateToRepresentRule: () -> Unit = {},
modifier: Modifier = Modifier,
title: String = "우리 집 Rules",
onBack: () -> Unit = { }
Expand Down Expand Up @@ -62,7 +62,7 @@ fun MainRuleToolbar(
)
}
)
MainRuleDropDownMenu(expanded, onDismiss)
MainRuleDropDownMenu(expanded, onDismiss, onNavigateToRepresentRule)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private fun NavGraphBuilder.mainRuleScreen(
onSearch = viewModel::searchRule,
onNavigateToAddRule = viewModel::canAddRule,
onNavigateToUpdateRule = navController::navigateUpdateRule,
onNavigateToRepresentRule = navController::navigateToRepresentRule,
onFinish = activity::finish,
refresh = viewModel::fetchMainRules,
deleteRule = viewModel::deleteRule,
Expand Down Expand Up @@ -309,7 +310,6 @@ private fun NavGraphBuilder.representativeRuleScreen(onBack: () -> Unit) {
}
}
// Navigation

fun NavController.navigateToAddRule() {
navigate(RulesScreens.Add.route)
}
Expand All @@ -321,3 +321,7 @@ fun NavController.navigateUpdateRule(detailRuleUiModel: DetailRuleUiModel) {
)
navigate(RulesScreens.Update.route)
}

fun NavController.navigateToRepresentRule() {
navigate(RulesScreens.Represent.route)
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fun MainRuleScreen(
onSearch: (String) -> Unit = {},
onNavigateToUpdateRule: (DetailRuleUiModel) -> Unit = {},
onNavigateToAddRule: () -> Unit = {},
onNavigateToRepresentRule: () -> Unit = {},
onFinish: () -> Unit = {},
refresh: () -> Unit = {}
) {
Expand Down Expand Up @@ -108,6 +109,7 @@ fun MainRuleScreen(
}
},
onNavigateToAddRule = onNavigateToAddRule,
onNavigateToRepresentRule = onNavigateToRepresentRule,
onFinish = onFinish
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import hous.release.android.R
import hous.release.android.presentation.our_rules.component.BasicUpdateRuleScreen
import hous.release.android.presentation.our_rules.component.update.BasicUpdateRuleScreen
import hous.release.android.presentation.our_rules.model.PhotoUiModel
import hous.release.designsystem.theme.HousTheme

Expand Down

0 comments on commit a57c596

Please sign in to comment.