Fix FAB animation on lexicon / quest / map list.
This commit is contained in:
		
							parent
							
								
									7652a6a902
								
							
						
					
					
						commit
						1c3d1a1036
					
				
					 7 changed files with 20 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue