Some code cleanups, and a bug fix
This commit is contained in:
parent
dde95a1c6b
commit
bfccbf2db8
2 changed files with 5 additions and 5 deletions
|
@ -22,6 +22,7 @@ import androidx.compose.ui.unit.dp
|
|||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.koin.getScreenModel
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import com.henryhiles.qweather.R
|
||||
import com.henryhiles.qweather.domain.geocoding.GeocodingData
|
||||
import com.henryhiles.qweather.presentation.components.navigation.SmallToolbar
|
||||
|
@ -37,7 +38,7 @@ class LocationPickerScreen : Screen {
|
|||
}
|
||||
var locationSearch by remember { mutableStateOf("") }
|
||||
var isAboutOpen by remember { mutableStateOf(false) }
|
||||
val navigator = LocalNavigator.current
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.imePadding(),
|
||||
|
@ -53,7 +54,7 @@ class LocationPickerScreen : Screen {
|
|||
}
|
||||
|
||||
with(navigator) {
|
||||
if (this != null) if (canPop) pop() else push(MainScreen())
|
||||
if (canPop) pop() else push(MainScreen())
|
||||
}
|
||||
} ?: kotlin.run { isAboutOpen = true }
|
||||
}) {
|
||||
|
@ -67,7 +68,7 @@ class LocationPickerScreen : Screen {
|
|||
Column {
|
||||
SmallToolbar(
|
||||
title = { Text(text = stringResource(id = R.string.location_choose)) },
|
||||
backButton = true,
|
||||
backButton = screenModel.prefs.locations.isNotEmpty(),
|
||||
actions = {
|
||||
IconButton(
|
||||
onClick = { isAboutOpen = true }) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import cafe.adriel.voyager.navigator.tab.TabOptions
|
||||
import com.henryhiles.qweather.R
|
||||
import com.henryhiles.qweather.domain.util.NavigationTab
|
||||
|
@ -58,7 +57,7 @@ object SettingsTab : NavigationTab {
|
|||
|
||||
@Composable
|
||||
override fun Actions() {
|
||||
val navigator = LocalNavigator.currentOrThrow.parent
|
||||
val navigator = LocalNavigator.current?.parent
|
||||
|
||||
IconButton(onClick = { navigator?.push(AboutScreen()) }) {
|
||||
Icon(
|
||||
|
|
Reference in a new issue