forked from melod1n/fast-messenger
more blur
This commit is contained in:
@@ -6,11 +6,11 @@ import androidx.compose.animation.fadeOut
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.NavigationBar
|
import androidx.compose.material3.NavigationBar
|
||||||
|
import androidx.compose.material3.NavigationBarDefaults
|
||||||
import androidx.compose.material3.NavigationBarItem
|
import androidx.compose.material3.NavigationBarItem
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -77,11 +77,16 @@ fun MainScreen(
|
|||||||
NavigationBar(
|
NavigationBar(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.hazeEffect(
|
.then(
|
||||||
|
if (theme.enableBlur) {
|
||||||
|
Modifier.hazeEffect(
|
||||||
state = hazeState,
|
state = hazeState,
|
||||||
style = HazeMaterials.thick()
|
style = HazeMaterials.thick()
|
||||||
|
)
|
||||||
|
} else Modifier
|
||||||
),
|
),
|
||||||
containerColor = Color.Transparent
|
containerColor = if (theme.enableBlur) Color.Transparent
|
||||||
|
else NavigationBarDefaults.containerColor
|
||||||
) {
|
) {
|
||||||
navigationItems.forEachIndexed { index, item ->
|
navigationItems.forEachIndexed { index, item ->
|
||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
|
|||||||
+21
-8
@@ -11,6 +11,7 @@ import androidx.compose.animation.core.animateFloatAsState
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -497,7 +498,7 @@ fun MessagesHistoryScreen(
|
|||||||
) {
|
) {
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val currentTheme = LocalThemeConfig.current
|
val theme = LocalThemeConfig.current
|
||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
val hazeState = remember { HazeState() }
|
val hazeState = remember { HazeState() }
|
||||||
|
|
||||||
@@ -541,7 +542,7 @@ fun MessagesHistoryScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val topBarContainerColorAlpha by animateFloatAsState(
|
val topBarContainerColorAlpha by animateFloatAsState(
|
||||||
targetValue = if (!currentTheme.enableBlur || !listState.canScrollBackward) 1f else 0f,
|
targetValue = if (!theme.enableBlur || !listState.canScrollBackward) 1f else 0f,
|
||||||
label = "toolbarColorAlpha",
|
label = "toolbarColorAlpha",
|
||||||
animationSpec = tween(
|
animationSpec = tween(
|
||||||
durationMillis = 200,
|
durationMillis = 200,
|
||||||
@@ -551,7 +552,7 @@ fun MessagesHistoryScreen(
|
|||||||
|
|
||||||
val topBarContainerColor by animateColorAsState(
|
val topBarContainerColor by animateColorAsState(
|
||||||
targetValue =
|
targetValue =
|
||||||
if (currentTheme.enableBlur || !listState.canScrollBackward) MaterialTheme.colorScheme.surface
|
if (theme.enableBlur || !listState.canScrollBackward) MaterialTheme.colorScheme.surface
|
||||||
else MaterialTheme.colorScheme.surfaceColorAtElevation(3.dp),
|
else MaterialTheme.colorScheme.surfaceColorAtElevation(3.dp),
|
||||||
label = "toolbarColorAlpha",
|
label = "toolbarColorAlpha",
|
||||||
animationSpec = tween(
|
animationSpec = tween(
|
||||||
@@ -579,7 +580,7 @@ fun MessagesHistoryScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(topBarContainerColor.copy(alpha = topBarContainerColorAlpha))
|
.background(topBarContainerColor.copy(alpha = topBarContainerColorAlpha))
|
||||||
.then(
|
.then(
|
||||||
if (currentTheme.enableBlur) {
|
if (theme.enableBlur) {
|
||||||
Modifier.hazeEffect(
|
Modifier.hazeEffect(
|
||||||
state = hazeState,
|
state = hazeState,
|
||||||
style = HazeMaterials.thick()
|
style = HazeMaterials.thick()
|
||||||
@@ -590,7 +591,7 @@ fun MessagesHistoryScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.then(
|
.then(
|
||||||
if (currentTheme.enableBlur) {
|
if (theme.enableBlur) {
|
||||||
Modifier.hazeEffect(
|
Modifier.hazeEffect(
|
||||||
state = hazeState,
|
state = hazeState,
|
||||||
style = HazeMaterials.thick()
|
style = HazeMaterials.thick()
|
||||||
@@ -841,13 +842,25 @@ fun MessagesHistoryScreen(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Spacer(modifier = Modifier.width(10.dp))
|
Spacer(modifier = Modifier.width(10.dp))
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.clip(RoundedCornerShape(36.dp))
|
||||||
|
.then(
|
||||||
|
if (theme.enableBlur) {
|
||||||
|
Modifier.hazeEffect(
|
||||||
|
state = hazeState,
|
||||||
|
style = HazeMaterials.ultraThin()
|
||||||
|
).border(1.dp, MaterialTheme.colorScheme.outlineVariant,
|
||||||
|
RoundedCornerShape(36.dp)
|
||||||
|
)
|
||||||
|
} else Modifier
|
||||||
|
)
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clip(RoundedCornerShape(36.dp))
|
.background(
|
||||||
.background(MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp))
|
if (theme.enableBlur) Color.Transparent
|
||||||
|
else MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp)
|
||||||
|
)
|
||||||
.onGloballyPositioned {
|
.onGloballyPositioned {
|
||||||
messageBarHeight = with(density) {
|
messageBarHeight = with(density) {
|
||||||
it.size.height.toDp()
|
it.size.height.toDp()
|
||||||
|
|||||||
Reference in New Issue
Block a user