Skip to content

Commit

Permalink
chore: impl nav for about screen
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal2376 committed Apr 4, 2024
1 parent 4c3afac commit d61eb60
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontStyle
Expand All @@ -32,7 +33,6 @@ import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.glance.LocalContext
import com.vishal2376.snaptick.R
import com.vishal2376.snaptick.presentation.about_screen.component.FeaturesComponent
import com.vishal2376.snaptick.presentation.common.AppTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.vishal2376.snaptick.presentation.about_screen.AboutScreen
import com.vishal2376.snaptick.presentation.add_edit_screen.AddTaskScreen
import com.vishal2376.snaptick.presentation.add_edit_screen.EditTaskScreen
import com.vishal2376.snaptick.presentation.calender_screen.CalenderScreen
Expand Down Expand Up @@ -165,6 +166,20 @@ fun AppNavigation(taskViewModel: TaskViewModel) {
SettingsScreen(
appState = taskViewModel.appState,
onEvent = taskViewModel::onEvent,
onClickAbout = {
navController.navigate(route = Routes.AboutScreen.name)
},
onBack = {
if (navController.isValidBackStack) {
navController.popBackStack()
}
}
)
}

composable(route = Routes.AboutScreen.name) {
AboutScreen(
appState = taskViewModel.appState,
onBack = {
if (navController.isValidBackStack) {
navController.popBackStack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ enum class Routes {
ThisWeekTaskScreen,
CalenderScreen,
SettingsScreen,
AboutScreen,
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import com.vishal2376.snaptick.util.openUrl
fun SettingsScreen(
appState: MainState,
onEvent: (MainEvent) -> Unit,
onClickAbout: () -> Unit,
onBack: () -> Unit
) {
val context = LocalContext.current
Expand All @@ -62,7 +63,7 @@ fun SettingsScreen(
val settingsAbout = listOf(
SettingCategoryItem(title = stringResource(R.string.about),
resId = R.drawable.ic_info,
onClick = {}
onClick = { onClickAbout() }
),
SettingCategoryItem(title = stringResource(R.string.support),
resId = R.drawable.ic_support,
Expand Down Expand Up @@ -216,6 +217,6 @@ fun SettingsScreen(
@Composable
fun SettingsScreenPreview() {
SnaptickTheme(theme = AppTheme.Amoled) {
SettingsScreen(MainState(), {}, {})
SettingsScreen(MainState(), {}, {}, {})
}
}

0 comments on commit d61eb60

Please sign in to comment.