|
@@ -0,0 +1,117 @@
|
|
|
+package com.zaojiao.app.ui.home.main
|
|
|
+
|
|
|
+import androidx.compose.foundation.Image
|
|
|
+import androidx.compose.foundation.background
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
+import androidx.compose.foundation.layout.Column
|
|
|
+import androidx.compose.foundation.layout.Row
|
|
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
+import androidx.compose.foundation.layout.height
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.requiredWidth
|
|
|
+import androidx.compose.foundation.layout.size
|
|
|
+import androidx.compose.foundation.layout.statusBarsPadding
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.wrapContentWidth
|
|
|
+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.draw.clip
|
|
|
+import androidx.compose.ui.graphics.Color
|
|
|
+import androidx.compose.ui.layout.ContentScale
|
|
|
+import androidx.compose.ui.res.painterResource
|
|
|
+import androidx.compose.ui.text.TextStyle
|
|
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.style.TextOverflow
|
|
|
+import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
+import com.zaojiao.app.R
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeMainTopBar() {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .statusBarsPadding()
|
|
|
+ .padding(top = 25.dp, bottom = 22.dp)
|
|
|
+ ) {
|
|
|
+ HomeMainTopBarUserInfo()
|
|
|
+ HomeMainTopBarSearchBar()
|
|
|
+ HomeMainTopMainSignupButton()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeMainTopBarUserInfo() {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 16.dp, end = 16.dp)
|
|
|
+ .background(
|
|
|
+ color = Color(0x260B57C7),
|
|
|
+ shape = RoundedCornerShape(100.dp)
|
|
|
+ )
|
|
|
+ .height(44.dp)
|
|
|
+ .wrapContentWidth(),
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ ) {
|
|
|
+ Image(
|
|
|
+ painter = painterResource(id = R.mipmap.ic_message),
|
|
|
+ contentDescription = "这是用户的头像",
|
|
|
+ modifier = Modifier
|
|
|
+ .clip(
|
|
|
+ shape = RoundedCornerShape(50),
|
|
|
+ )
|
|
|
+ .size(44.dp),
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ )
|
|
|
+ Box(modifier = Modifier.width(4.dp))
|
|
|
+ Column {
|
|
|
+ Text(
|
|
|
+ text = "逻辑狗",
|
|
|
+ modifier = Modifier.requiredWidth(45.dp),
|
|
|
+ maxLines = 1,
|
|
|
+ overflow = TextOverflow.Ellipsis,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Color(0xFF0B57C7),
|
|
|
+ fontSize = 13.sp,
|
|
|
+ lineHeight = 18.sp,
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "3岁8个月",
|
|
|
+ maxLines = 1,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Color(0x990B57C7),
|
|
|
+ fontSize = 11.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Box(modifier = Modifier.width(12.dp))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeMainTopBarSearchBar() {
|
|
|
+ Box(
|
|
|
+ ) {
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeMainTopMainSignupButton() {
|
|
|
+ Image(
|
|
|
+ painter = painterResource(id = R.mipmap.ic_message),
|
|
|
+ contentDescription = "这是用户的头像",
|
|
|
+ modifier = Modifier
|
|
|
+ .clip(
|
|
|
+ shape = RoundedCornerShape(50),
|
|
|
+ )
|
|
|
+ .size(44.dp),
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ )
|
|
|
+}
|