Fix FAB animation on lexicon / quest / map list.

This commit is contained in:
Andres Gomez, Thomas (ITDV RL) 2024-05-29 13:53:58 +02:00
parent 7652a6a902
commit 1c3d1a1036
7 changed files with 20 additions and 13 deletions

View file

@ -1,5 +1,6 @@
package com.pixelized.rplexicon.ui.navigation
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.staticCompositionLocalOf
@ -32,6 +33,10 @@ fun ScreenNavHost(
navHostController: NavHostController = rememberNavController(),
startDestination: String = AUTHENTICATION_ROUTE,
) {
val lexiconLazyListState = rememberLazyListState()
val questsLazyListState = rememberLazyListState()
val locationsLazyListState = rememberLazyListState()
CompositionLocalProvider(
LocalScreenNavHost provides navHostController,
) {
@ -46,11 +51,11 @@ fun ScreenNavHost(
)
composableLanding()
composableSearch()
composableLexicon()
composableLexicon(lazyListState = lexiconLazyListState)
composableLexiconDetail()
composableQuests()
composableQuests(lazyListState = questsLazyListState)
composableQuestDetail()
composableLocations()
composableLocations(lazyListState = locationsLazyListState)
composableLocationDetail()
composableCharacterSheet()
composableSpellDetail()

View file

@ -1,5 +1,6 @@
package com.pixelized.rplexicon.ui.navigation.screens
import androidx.compose.foundation.lazy.LazyListState
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptionsBuilder
@ -11,12 +12,12 @@ private const val ROUTE = "lexicon"
const val LEXICON_LIST_ROUTE = ROUTE
fun NavGraphBuilder.composableLexicon() {
fun NavGraphBuilder.composableLexicon(lazyListState: LazyListState) {
animatedComposable(
route = LEXICON_LIST_ROUTE,
animation = NavigationAnimation.Push,
) {
LexiconScreen()
LexiconScreen(lazyListState = lazyListState)
}
}

View file

@ -1,5 +1,6 @@
package com.pixelized.rplexicon.ui.navigation.screens
import androidx.compose.foundation.lazy.LazyListState
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptionsBuilder
@ -11,12 +12,12 @@ private const val ROUTE = "locations"
const val LOCATION_LIST_ROUTE = ROUTE
fun NavGraphBuilder.composableLocations() {
fun NavGraphBuilder.composableLocations(lazyListState: LazyListState) {
animatedComposable(
route = LOCATION_LIST_ROUTE,
animation = NavigationAnimation.Push,
) {
LocationScreen()
LocationScreen(lazyListState = lazyListState)
}
}

View file

@ -1,5 +1,6 @@
package com.pixelized.rplexicon.ui.navigation.screens
import androidx.compose.foundation.lazy.LazyListState
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptionsBuilder
@ -11,12 +12,12 @@ private const val ROUTE = "quests"
const val QUEST_LIST_ROUTE = ROUTE
fun NavGraphBuilder.composableQuests() {
fun NavGraphBuilder.composableQuests(lazyListState: LazyListState) {
animatedComposable(
route = QUEST_LIST_ROUTE,
animation = NavigationAnimation.Push,
) {
QuestListScreen()
QuestListScreen(lazyListState = lazyListState)
}
}

View file

@ -61,10 +61,10 @@ import kotlinx.coroutines.launch
@Composable
fun LexiconScreen(
viewModel: LexiconViewModel = hiltViewModel(),
lazyListState: LazyListState = rememberLazyListState(),
) {
val screen = LocalScreenNavHost.current
val scope = rememberCoroutineScope()
val lazyListState = rememberLazyListState()
val refresh = rememberPullRefreshState(
refreshing = false,
onRefresh = {

View file

@ -58,10 +58,10 @@ import kotlinx.coroutines.launch
@Composable
fun LocationScreen(
viewModel: LocationViewModel = hiltViewModel(),
lazyListState: LazyListState = rememberLazyListState(),
) {
val screen = LocalScreenNavHost.current
val scope = rememberCoroutineScope()
val lazyListState = rememberLazyListState()
val refresh = rememberPullRefreshState(
refreshing = false,

View file

@ -58,11 +58,10 @@ import kotlinx.coroutines.launch
@Composable
fun QuestListScreen(
viewModel: QuestListViewModel = hiltViewModel(),
lazyListState: LazyListState = rememberLazyListState(),
) {
val screen = LocalScreenNavHost.current
val scope = rememberCoroutineScope()
val lazyListState = rememberLazyListState()
val refresh = rememberPullRefreshState(
refreshing = false,
onRefresh = {