mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
Using Slide in and out instead of crossfade for the top and bottom bars.
This commit is contained in:
parent
8b7406e25a
commit
831386a656
@ -2,8 +2,14 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn
|
|||||||
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.animation.slideInVertically
|
||||||
|
import androidx.compose.animation.slideOutVertically
|
||||||
|
import androidx.compose.animation.togetherWith
|
||||||
|
import androidx.compose.animation.with
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -51,7 +57,7 @@ import com.vitorpamplona.amethyst.ui.screen.NotificationViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.ThemeViewModel
|
import com.vitorpamplona.amethyst.ui.screen.ThemeViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterialApi::class)
|
@OptIn(ExperimentalMaterialApi::class, ExperimentalAnimationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun MainScreen(
|
fun MainScreen(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
@ -216,21 +222,27 @@ fun MainScreen(
|
|||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
.nestedScroll(nestedScrollConnection),
|
.nestedScroll(nestedScrollConnection),
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
Crossfade(
|
AnimatedContent(
|
||||||
targetState = shouldShow,
|
targetState = shouldShow,
|
||||||
animationSpec = tween(durationMillis = 100)
|
transitionSpec = {
|
||||||
) { state ->
|
slideInVertically { height -> height } togetherWith
|
||||||
if (state) {
|
slideOutVertically { height -> height }
|
||||||
|
}
|
||||||
|
) { isVisible ->
|
||||||
|
if (isVisible) {
|
||||||
AppBottomBar(accountViewModel, navState, navBottomRow)
|
AppBottomBar(accountViewModel, navState, navBottomRow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
topBar = {
|
topBar = {
|
||||||
Crossfade(
|
AnimatedContent(
|
||||||
targetState = shouldShow,
|
targetState = shouldShow,
|
||||||
animationSpec = tween(durationMillis = 100)
|
transitionSpec = {
|
||||||
) { state ->
|
slideInVertically { height -> 0 } togetherWith
|
||||||
if (state) {
|
slideOutVertically { height -> 0 }
|
||||||
|
}
|
||||||
|
) { isVisible ->
|
||||||
|
if (isVisible) {
|
||||||
AppTopBar(
|
AppTopBar(
|
||||||
followLists,
|
followLists,
|
||||||
navState,
|
navState,
|
||||||
|
Loading…
Reference in New Issue
Block a user