|
@@ -0,0 +1,172 @@
|
|
|
+package com.zaojiao.component.personal
|
|
|
+
|
|
|
+import androidx.annotation.DrawableRes
|
|
|
+import androidx.compose.foundation.Image
|
|
|
+import androidx.compose.foundation.background
|
|
|
+import androidx.compose.foundation.layout.Arrangement
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
+import androidx.compose.foundation.layout.Column
|
|
|
+import androidx.compose.foundation.layout.Row
|
|
|
+import androidx.compose.foundation.layout.RowScope
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
+import androidx.compose.foundation.layout.height
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.widthIn
|
|
|
+import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
+import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
+import androidx.compose.material3.Text
|
|
|
+import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.ui.Alignment
|
|
|
+import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.graphics.Color
|
|
|
+import androidx.compose.ui.res.painterResource
|
|
|
+import androidx.compose.ui.text.TextStyle
|
|
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
+import com.zaojiao.component.common.shadow
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomePersonalService() {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(
|
|
|
+ horizontal = 8.dp,
|
|
|
+ vertical = 4.dp,
|
|
|
+ )
|
|
|
+ .shadow(
|
|
|
+ color = Color(0xFFF4F4F4),
|
|
|
+ offsetX = 0.dp,
|
|
|
+ offsetY = 2.dp,
|
|
|
+ blurRadius = 6.dp,
|
|
|
+ shadowRadius = 20.dp,
|
|
|
+ )
|
|
|
+ .background(
|
|
|
+ color = Color.White,
|
|
|
+ shape = RoundedCornerShape(20.dp),
|
|
|
+ ),
|
|
|
+ ) {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .wrapContentHeight()
|
|
|
+ .fillMaxWidth(),
|
|
|
+ ) {
|
|
|
+ Box(modifier = Modifier.height(16.dp))
|
|
|
+
|
|
|
+ Box(
|
|
|
+ modifier = Modifier.padding(start = 14.dp),
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ text = "我的服务",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 16.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ letterSpacing = 0.38.sp,
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ color = Color(0xFF333333),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ Box(modifier = Modifier.height(18.dp))
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .wrapContentHeight(),
|
|
|
+ horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
+ ) {
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_baby,
|
|
|
+ description = "宝宝档案",
|
|
|
+ )
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_address,
|
|
|
+ description = "优惠券",
|
|
|
+ )
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_verify,
|
|
|
+ description = "查询真伪",
|
|
|
+ )
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_material,
|
|
|
+ description = "资料领取",
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Box(modifier = Modifier.height(21.dp))
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .wrapContentHeight(),
|
|
|
+ horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
+ ) {
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_customer,
|
|
|
+ description = "在线客服",
|
|
|
+ )
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_feedback,
|
|
|
+ description = "帮助与反馈",
|
|
|
+ )
|
|
|
+ HomePersonalServiceItem(
|
|
|
+ iconRes = R.mipmap.personal_setting,
|
|
|
+ description = "设置",
|
|
|
+ )
|
|
|
+ HomePersonalServiceBlank()
|
|
|
+ }
|
|
|
+ Box(modifier = Modifier.height(27.dp))
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun RowScope.HomePersonalServiceItem(
|
|
|
+ @DrawableRes iconRes: Int,
|
|
|
+ description: String,
|
|
|
+) {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .weight(1f)
|
|
|
+ .fillMaxHeight()
|
|
|
+ .widthIn(max = 64.dp),
|
|
|
+ verticalArrangement = Arrangement.SpaceBetween,
|
|
|
+ horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
+ ) {
|
|
|
+ Image(
|
|
|
+ painter = painterResource(id = iconRes),
|
|
|
+ contentDescription = description,
|
|
|
+ modifier = Modifier
|
|
|
+ .width(34.dp)
|
|
|
+ .height(34.dp)
|
|
|
+ )
|
|
|
+ Box(modifier = Modifier.height(2.dp))
|
|
|
+ Text(
|
|
|
+ text = description,
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 12.sp,
|
|
|
+ lineHeight = 12.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ color = Color(0xFF333333),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun RowScope.HomePersonalServiceBlank() {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .weight(1f)
|
|
|
+ .fillMaxHeight()
|
|
|
+ .widthIn(max = 64.dp),
|
|
|
+ verticalArrangement = Arrangement.SpaceBetween,
|
|
|
+ horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .width(34.dp)
|
|
|
+ .height(48.dp)
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|