修正个人主页阴影错误

This commit is contained in:
2024-10-26 23:05:31 +08:00
parent e1ba8709de
commit be18a60b2b

View File

@@ -3,7 +3,6 @@ package com.aiosman.riderpro.ui.index.tabs.profile
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.widget.Toast
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
@@ -62,12 +61,10 @@ import androidx.compose.ui.unit.sp
import androidx.paging.PagingData import androidx.paging.PagingData
import androidx.paging.compose.collectAsLazyPagingItems import androidx.paging.compose.collectAsLazyPagingItems
import com.aiosman.riderpro.AppState import com.aiosman.riderpro.AppState
import com.aiosman.riderpro.AppStore
import com.aiosman.riderpro.ConstVars import com.aiosman.riderpro.ConstVars
import com.aiosman.riderpro.DarkThemeColors
import com.aiosman.riderpro.LightThemeColors
import com.aiosman.riderpro.LocalAppTheme import com.aiosman.riderpro.LocalAppTheme
import com.aiosman.riderpro.LocalNavController import com.aiosman.riderpro.LocalNavController
import com.aiosman.riderpro.MainActivity
import com.aiosman.riderpro.R import com.aiosman.riderpro.R
import com.aiosman.riderpro.entity.AccountProfileEntity import com.aiosman.riderpro.entity.AccountProfileEntity
import com.aiosman.riderpro.entity.MomentEntity import com.aiosman.riderpro.entity.MomentEntity
@@ -90,6 +87,7 @@ import com.aiosman.riderpro.ui.index.tabs.profile.composable.UserItem
import com.aiosman.riderpro.ui.modifiers.noRippleClickable import com.aiosman.riderpro.ui.modifiers.noRippleClickable
import com.aiosman.riderpro.ui.post.NewPostViewModel import com.aiosman.riderpro.ui.post.NewPostViewModel
import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.google.accompanist.systemuicontroller.rememberSystemUiController
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
@@ -138,8 +136,18 @@ fun ProfileV3(
var AppColors = appTheme var AppColors = appTheme
var systemUiController = rememberSystemUiController() var systemUiController = rememberSystemUiController()
fun switchTheme(){ fun switchTheme(){
// delay
scope.launch {
delay(200)
AppState.switchTheme() AppState.switchTheme()
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode) systemUiController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode)
if (AppState.darkMode) {
(context as MainActivity).window.decorView.setBackgroundColor(android.graphics.Color.BLACK)
}else{
(context as MainActivity).window.decorView.setBackgroundColor(android.graphics.Color.WHITE)
}
}
} }
Box( Box(
modifier = Modifier.pullRefresh(refreshState) modifier = Modifier.pullRefresh(refreshState)
@@ -190,6 +198,7 @@ fun ProfileV3(
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(bannerHeight.dp - 24.dp)
.let { .let {
if (isSelf) { if (isSelf) {
it.noRippleClickable { it.noRippleClickable {
@@ -207,7 +216,7 @@ fun ProfileV3(
shape = RoundedCornerShape( shape = RoundedCornerShape(
bottomStart = 32.dp, bottomStart = 32.dp,
bottomEnd = 32.dp bottomEnd = 32.dp
) ),
) )
) { ) {
val banner = profile?.banner val banner = profile?.banner
@@ -245,9 +254,6 @@ fun ProfileV3(
modifier = Modifier modifier = Modifier
.padding(16.dp) .padding(16.dp)
.clip(RoundedCornerShape(8.dp)) .clip(RoundedCornerShape(8.dp))
.shadow(
elevation = 20.dp
)
.background(AppColors.background.copy(alpha = 0.7f)) .background(AppColors.background.copy(alpha = 0.7f))
) { ) {
Icon( Icon(
@@ -321,7 +327,7 @@ fun ProfileV3(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
) { ) {
Spacer(modifier = Modifier.height(16.dp)) // Spacer(modifier = Modifier.height(16.dp))
// 个人信息 // 个人信息
Box( Box(
modifier = Modifier.padding(horizontal = 16.dp) modifier = Modifier.padding(horizontal = 16.dp)