diff --git a/composeApp/src/commonMain/kotlin/component/Search.kt b/composeApp/src/commonMain/kotlin/component/Search.kt index 6cdc6e5..a936cef 100644 --- a/composeApp/src/commonMain/kotlin/component/Search.kt +++ b/composeApp/src/commonMain/kotlin/component/Search.kt @@ -9,7 +9,6 @@ import androidx.compose.material.icons.filled.Clear import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.outlined.Info -import androidx.compose.material.icons.outlined.Place import androidx.compose.material.icons.outlined.Settings import androidx.compose.material3.* import androidx.compose.runtime.* @@ -22,7 +21,12 @@ import androidx.compose.ui.semantics.traversalIndex import androidx.compose.ui.unit.dp import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow +import org.jetbrains.compose.resources.painterResource +import tab.About import tab.Licenses +import tab.setting.Settings +import veganenumbers.composeapp.generated.resources.Res +import veganenumbers.composeapp.generated.resources.handshake_24px @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -83,13 +87,12 @@ private fun OptionsMenu(expanded: MutableState) { ) { DropdownMenuItem( text = { Text("Settings") }, - onClick = { /* TODO open settings screen */ }, + onClick = { navigator.push(Settings) }, leadingIcon = { Icon(imageVector = Icons.Outlined.Settings, contentDescription = "Open settings") } ) DropdownMenuItem( text = { Text("About") }, - onClick = { /* TODO open about screen */ }, - leadingIcon = { Icon(imageVector = Icons.Outlined.Place, contentDescription = "Information about the application") } + onClick = { navigator.push(About) }, leadingIcon = { Icon(imageVector = Icons.Outlined.Info, contentDescription = "Information about the application") } ) DropdownMenuItem( diff --git a/composeApp/src/commonMain/kotlin/tab/About.kt b/composeApp/src/commonMain/kotlin/tab/About.kt new file mode 100644 index 0000000..4281d17 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/tab/About.kt @@ -0,0 +1,47 @@ +package tab + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import cafe.adriel.voyager.core.screen.Screen +import cafe.adriel.voyager.navigator.LocalNavigator +import cafe.adriel.voyager.navigator.currentOrThrow + +object About : Screen { + + @OptIn(ExperimentalMaterial3Api::class) + @Composable + override fun Content() { + val navigator = LocalNavigator.currentOrThrow + val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) + + Scaffold ( + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + topBar = { + TopAppBar( + title = { Text("About") }, + navigationIcon = { + IconButton(onClick = { navigator.pop() }) { + Icon(imageVector = Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Go back to main app") + } + }, + scrollBehavior = scrollBehavior + ) + }, + ) { + Column (modifier = Modifier.padding(it)) { + AboutContent() + } + } + } + + @Composable + private fun AboutContent() { + Text("This app was created by Anthony Berg") + } +} diff --git a/composeApp/src/commonMain/kotlin/tab/setting/Settings.kt b/composeApp/src/commonMain/kotlin/tab/setting/Settings.kt new file mode 100644 index 0000000..ea1ece2 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/tab/setting/Settings.kt @@ -0,0 +1,48 @@ +package tab.setting + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import cafe.adriel.voyager.core.screen.Screen +import cafe.adriel.voyager.navigator.LocalNavigator +import cafe.adriel.voyager.navigator.currentOrThrow + +object Settings : Screen { + + @OptIn(ExperimentalMaterial3Api::class) + @Composable + override fun Content() { + val navigator = LocalNavigator.currentOrThrow + val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) + + Scaffold ( + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + topBar = { + TopAppBar( + title = { Text("Settings") }, + navigationIcon = { + IconButton(onClick = { navigator.pop() }) { + Icon(imageVector = Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Go back to main app") + } + }, + scrollBehavior = scrollBehavior + ) + }, + ) { + Column (modifier = Modifier.padding(it)) { + SettingsContent() + } + } + } + + @Composable + private fun SettingsContent() { + Text("Theme") + Text("List Style") + } +}