mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 21:07:04 +05:30
refactor: switch to rememberNavBackStack helper
This commit is contained in:
parent
1385edc3bf
commit
699afafcf9
4 changed files with 8 additions and 6 deletions
|
@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import dev.chrisbanes.haze.HazeDefaults
|
||||
import dev.chrisbanes.haze.HazeState
|
||||
import dev.chrisbanes.haze.HazeStyle
|
||||
|
@ -40,7 +41,7 @@ const val AnimationDuration = 100
|
|||
|
||||
@Composable
|
||||
fun ClawNavigationBar(
|
||||
backStack: SnapshotStateList<Destination>,
|
||||
backStack: SnapshotStateList<NavKey>,
|
||||
items: ImmutableList<NavigationItem>,
|
||||
isVisible: Boolean,
|
||||
hazeState: HazeState,
|
||||
|
|
|
@ -22,12 +22,12 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import dev.msfjarvis.claw.android.ui.navigation.Destination
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Composable
|
||||
fun ClawNavigationRail(
|
||||
backStack: SnapshotStateList<Destination>,
|
||||
backStack: SnapshotStateList<NavKey>,
|
||||
items: ImmutableList<NavigationItem>,
|
||||
isVisible: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
|
@ -15,10 +15,11 @@ import androidx.compose.material.icons.outlined.FavoriteBorder
|
|||
import androidx.compose.material.icons.outlined.NewReleases
|
||||
import androidx.compose.material.icons.outlined.Whatshot
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
sealed interface Destination : Parcelable
|
||||
sealed interface Destination : Parcelable, NavKey
|
||||
|
||||
@Parcelize @Serializable data object Hottest : Destination
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import androidx.compose.material3.windowsizeclass.WindowSizeClass
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -42,6 +41,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.navigation3.runtime.entry
|
||||
import androidx.navigation3.runtime.entryProvider
|
||||
import androidx.navigation3.runtime.rememberNavBackStack
|
||||
import androidx.navigation3.ui.NavDisplay
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.deliveryhero.whetstone.compose.injectedViewModel
|
||||
|
@ -83,7 +83,7 @@ fun Nav3Screen(
|
|||
modifier: Modifier = Modifier,
|
||||
viewModel: ClawViewModel = injectedViewModel(),
|
||||
) {
|
||||
val backStack = remember { mutableStateListOf<Destination>(Hottest) }
|
||||
val backStack = rememberNavBackStack<Destination>(Hottest)
|
||||
|
||||
// region Pain
|
||||
val context = LocalContext.current
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue