修改颜色配置

This commit is contained in:
2025-08-05 16:00:36 +08:00
parent 873001ce28
commit 6433d4a23c
2 changed files with 12 additions and 147 deletions

View File

@@ -116,7 +116,7 @@ fun AccountEditScreen2() {
}, },
imageVector = Icons.Default.Check, imageVector = Icons.Default.Check,
contentDescription = "保存", contentDescription = "保存",
tint = if (validate() && !model.isUpdating) Color.Black else Color.Gray tint = if (validate() && !model.isUpdating) appColors.text else appColors.nonActiveText
) )
} }
} }

View File

@@ -11,8 +11,7 @@ import androidx.compose.animation.core.infiniteRepeatable
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.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -35,7 +34,7 @@ import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material3.BasicAlertDialog import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Switch import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -131,7 +130,7 @@ fun NewPostScreen() {
Box( Box(
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(8.dp)) .clip(RoundedCornerShape(8.dp))
.background(color = Color(0xFFEEEEEE)) .background(color = AppColors.basicMain)
.padding(24.dp) .padding(24.dp)
) { ) {
RelPostCard( RelPostCard(
@@ -205,11 +204,11 @@ fun NewPostScreen() {
checkedThumbColor = Color.White, checkedThumbColor = Color.White,
checkedTrackColor = AppColors.brandColorsColor, checkedTrackColor = AppColors.brandColorsColor,
uncheckedThumbColor = Color.White, uncheckedThumbColor = Color.White,
uncheckedTrackColor = Color(0xFFE9E9EA), uncheckedTrackColor = AppColors.nonActive,
uncheckedBorderColor = Color.White, uncheckedBorderColor = Color.White,
disabledCheckedTrackColor = AppColors.brandColorsColor.copy(alpha = 0.8f), disabledCheckedTrackColor = AppColors.brandColorsColor.copy(alpha = 0.8f),
disabledCheckedThumbColor= Color.White, disabledCheckedThumbColor= Color.White,
disabledUncheckedTrackColor = Color(0xFFE9E9EA), disabledUncheckedTrackColor = AppColors.nonActive,
disabledUncheckedThumbColor= Color.White disabledUncheckedThumbColor= Color.White
), ),
@@ -426,6 +425,7 @@ fun NewPostTextField(hint: String, value: String, onValueChange: (String) -> Uni
@Composable @Composable
fun AddImageGrid() { fun AddImageGrid() {
val AppColors = LocalAppTheme.current
val navController = LocalNavController.current val navController = LocalNavController.current
val context = LocalContext.current val context = LocalContext.current
val model = NewPostViewModel val model = NewPostViewModel
@@ -497,7 +497,7 @@ fun AddImageGrid() {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.background(Color(0x66000000)) .background(Color.Black.copy(alpha = 0.4f))
) )
} }
} }
@@ -517,7 +517,7 @@ fun AddImageGrid() {
.fillMaxWidth() .fillMaxWidth()
.aspectRatio(1f) .aspectRatio(1f)
.clip(RoundedCornerShape(16.dp)) // 设置圆角 .clip(RoundedCornerShape(16.dp)) // 设置圆角
.background(Color(0xFFFAF9FB)) // 设置背景色 .background(AppColors.basicMain) // 设置背景色
.noRippleClickable { .noRippleClickable {
pickImagesLauncher.launch("image/*") pickImagesLauncher.launch("image/*")
}, },
@@ -528,7 +528,7 @@ fun AddImageGrid() {
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
.align(Alignment.Center), .align(Alignment.Center),
tint = Color(0xFFD6D6D6) tint = AppColors.nonActiveText
) )
} }
@@ -539,7 +539,7 @@ fun AddImageGrid() {
.fillMaxWidth() .fillMaxWidth()
.aspectRatio(1f) .aspectRatio(1f)
.clip(RoundedCornerShape(16.dp)) // 设置圆角 .clip(RoundedCornerShape(16.dp)) // 设置圆角
.background(Color(0xFFFAF9FB)) // 设置背景色 .background(AppColors.basicMain) // 设置背景色
.noRippleClickable { .noRippleClickable {
val photoFile = File(context.cacheDir, "photo.jpg") val photoFile = File(context.cacheDir, "photo.jpg")
val photoUri: Uri = FileProvider.getUriForFile( val photoUri: Uri = FileProvider.getUriForFile(
@@ -557,145 +557,10 @@ fun AddImageGrid() {
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
.align(Alignment.Center), .align(Alignment.Center),
tint = Color(0xFFD6D6D6) tint = AppColors.nonActiveText
) )
} }
} }
} }
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AdditionalPostItem() {
val model = NewPostViewModel
val navController = LocalNavController.current
var isShowLocationModal by remember { mutableStateOf(false) }
fun onSelectLocationClick() {
isShowLocationModal = true
}
if (isShowLocationModal) {
ModalBottomSheet(
onDismissRequest = {
isShowLocationModal = false
},
containerColor = Color.White
) {
// Sheet content
SelectLocationModal(
onClose = {
isShowLocationModal = false
}
) {
isShowLocationModal = false
NewPostViewModel.searchPlaceAddressResult = it
}
}
}
Column(
modifier = Modifier.fillMaxWidth()
) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp, horizontal = 24.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() }
) {
onSelectLocationClick()
}
) {
NewPostViewModel.searchPlaceAddressResult?.let {
SelectedLocation(it) {
NewPostViewModel.searchPlaceAddressResult = null
}
} ?: Row(
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = R.drawable.rider_pro_add_location),
contentDescription = "Location",
modifier = Modifier.size(24.dp)
)
Spacer(modifier = Modifier.width(12.dp))
Text("Add Location", color = Color(0xFF333333))
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = R.drawable.rider_pro_nav_next),
contentDescription = "Add Location",
modifier = Modifier.size(24.dp)
)
}
}
Box(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp, horizontal = 24.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() }
) {
navController.navigate("EditModification")
}
) {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = R.drawable.rider_pro_modification),
contentDescription = "Modification List",
modifier = Modifier.size(24.dp)
)
Spacer(modifier = Modifier.width(12.dp))
Text("Modification List", color = Color(0xFF333333))
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = R.drawable.rider_pro_nav_next),
contentDescription = "Modification List",
modifier = Modifier.size(24.dp)
)
}
}
}
}
@Composable
fun SelectedLocation(
searchPlaceAddressResult: SearchPlaceAddressResult,
onRemoveLocation: () -> Unit
) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Column(
modifier = Modifier
.weight(1f)
.padding(end = 16.dp)
) {
Text(searchPlaceAddressResult.name, fontWeight = FontWeight.Bold)
Spacer(modifier = Modifier.height(4.dp))
Text(searchPlaceAddressResult.address, color = Color(0xFF9a9a9a))
}
Image(
painter = painterResource(id = R.drawable.rider_pro_close),
contentDescription = "Next",
modifier = Modifier
.size(24.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() }
) {
onRemoveLocation()
}
)
}
}
}