mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-05 20:32:35 +02:00
StateWithLifecycle seems to be the wrong option here.
This commit is contained in:
@@ -3,13 +3,14 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AccountScreen(accountStateViewModel: AccountStateViewModel, startingPage: String?) {
|
fun AccountScreen(accountStateViewModel: AccountStateViewModel, startingPage: String?) {
|
||||||
val accountState by accountStateViewModel.accountContent.collectAsStateWithLifecycle()
|
val accountState by accountStateViewModel.accountContent.collectAsState()
|
||||||
|
|
||||||
Column() {
|
Column() {
|
||||||
Crossfade(targetState = accountState) { state ->
|
Crossfade(targetState = accountState) { state ->
|
||||||
|
@@ -11,6 +11,7 @@ import androidx.compose.material.Scaffold
|
|||||||
import androidx.compose.material.rememberDrawerState
|
import androidx.compose.material.rememberDrawerState
|
||||||
import androidx.compose.material.rememberScaffoldState
|
import androidx.compose.material.rememberScaffoldState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -57,7 +58,7 @@ fun MainScreen(accountViewModel: AccountViewModel, accountStateViewModel: Accoun
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FloatingButton(navController: NavHostController, accountViewModel: AccountStateViewModel) {
|
fun FloatingButton(navController: NavHostController, accountViewModel: AccountStateViewModel) {
|
||||||
val accountState by accountViewModel.accountContent.collectAsStateWithLifecycle()
|
val accountState by accountViewModel.accountContent.collectAsState()
|
||||||
|
|
||||||
if (currentRoute(navController) == Route.Home.route) {
|
if (currentRoute(navController) == Route.Home.route) {
|
||||||
Crossfade(targetState = accountState) { state ->
|
Crossfade(targetState = accountState) { state ->
|
||||||
|
Reference in New Issue
Block a user