|
@@ -1,37 +1,188 @@
|
|
|
package com.zaojiao.app.feat.home.course
|
|
|
|
|
|
-import androidx.compose.foundation.background
|
|
|
-import androidx.compose.foundation.layout.Arrangement
|
|
|
+import androidx.compose.foundation.border
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
-import androidx.compose.foundation.layout.PaddingValues
|
|
|
+import androidx.compose.foundation.layout.Row
|
|
|
+import androidx.compose.foundation.layout.aspectRatio
|
|
|
+import androidx.compose.foundation.layout.fillMaxSize
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
-import androidx.compose.foundation.lazy.grid.GridCells
|
|
|
-import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
|
|
+import androidx.compose.foundation.lazy.LazyRow
|
|
|
+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.draw.clip
|
|
|
+import androidx.compose.ui.geometry.Size
|
|
|
+import androidx.compose.ui.graphics.painter.ColorPainter
|
|
|
+import androidx.compose.ui.layout.ContentScale
|
|
|
+import androidx.compose.ui.text.TextStyle
|
|
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.style.TextDecoration
|
|
|
+import androidx.compose.ui.text.style.TextOverflow
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
+import coil.compose.AsyncImage
|
|
|
+import com.zaojiao.component.common.Colors
|
|
|
+import com.zaojiao.component.common.Expanded
|
|
|
+import com.zaojiao.component.common.Icons
|
|
|
+import com.zaojiao.component.common.Images
|
|
|
import com.zaojiao.component.common.Spacer
|
|
|
+import com.zaojiao.component.common.list
|
|
|
|
|
|
@Composable
|
|
|
internal fun HomeCourseRecommend() {
|
|
|
- LazyVerticalGrid(
|
|
|
- columns = GridCells.Fixed(2),
|
|
|
- horizontalArrangement = Arrangement.spacedBy(12.dp),
|
|
|
- verticalArrangement = Arrangement.spacedBy(20.dp),
|
|
|
- contentPadding = PaddingValues(horizontal = 16.dp),
|
|
|
- userScrollEnabled = false,
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 16.dp, vertical = 20.dp)
|
|
|
+ .wrapContentHeight()
|
|
|
+ .fillMaxWidth()
|
|
|
) {
|
|
|
- items(100) { index ->
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
- .background(color = Color.Red)
|
|
|
- .wrapContentHeight()
|
|
|
- .fillMaxWidth()
|
|
|
- ) {
|
|
|
- Spacer(height = 200.dp)
|
|
|
- }
|
|
|
+ HomeCourserRecommendTitle()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeCourserRecommendTitle() {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier.wrapContentHeight(),
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ ) {
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = "逻辑狗推荐官",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 18.sp,
|
|
|
+ lineHeight = 18.sp,
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ color = Colors.FF333333,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
+ Expanded()
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = "查看全部",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 12.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ color = Colors.FF999999,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ Spacer(width = 4.dp)
|
|
|
+
|
|
|
+ Icons.Forward(
|
|
|
+ size = Size(3.6f, 6f),
|
|
|
+ color = Colors.FF999999,
|
|
|
+ width = 0.5.dp,
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeCourseRecommendItem() {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .wrapContentHeight()
|
|
|
+ .fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Images.Network(
|
|
|
+ url = "https://t7.baidu.com/it/u=1595072465,3644073269&fm=193&f=GIF",
|
|
|
+ description = "人文地理学家",
|
|
|
+ modifier = Modifier
|
|
|
+ .clip(RoundedCornerShape(20.dp))
|
|
|
+ .aspectRatio(1f)
|
|
|
+ .fillMaxSize(),
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ )
|
|
|
+ Spacer(height = 13.dp)
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = "人文地理学家人文地理学家人文地理学家人文地理学家",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 15.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ color = Colors.FF333333,
|
|
|
+ ),
|
|
|
+ maxLines = 1,
|
|
|
+ overflow = TextOverflow.Ellipsis,
|
|
|
+ )
|
|
|
+ Spacer(height = 9.dp)
|
|
|
+ LazyRow() {
|
|
|
+ list(count = 4,
|
|
|
+ itemContent = { index ->
|
|
|
+ HomeCourseRecommendItemTag()
|
|
|
+ },
|
|
|
+ itemSeparation = { index ->
|
|
|
+ Box(modifier = Modifier.width(4.dp))
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Spacer(height = 12.dp)
|
|
|
+ Row(
|
|
|
+ modifier = Modifier.wrapContentHeight(),
|
|
|
+ verticalAlignment = Alignment.Bottom,
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ text = "¥",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 10.sp,
|
|
|
+ lineHeight = 14.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ color = Colors.from("#FFFF5749"),
|
|
|
+ ),
|
|
|
+ modifier = Modifier.padding(bottom = 2.dp)
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "30.0",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 18.sp,
|
|
|
+ lineHeight = 18.sp,
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ color = Colors.from("#FFFF5749"),
|
|
|
+ ),
|
|
|
+ modifier = Modifier.padding(top = 1.dp)
|
|
|
+ )
|
|
|
+ Spacer(width = 3.dp)
|
|
|
+ Text(
|
|
|
+ text = "¥158.0",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 10.sp,
|
|
|
+ lineHeight = 14.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ color = Colors.FF999999,
|
|
|
+ textDecoration = TextDecoration.LineThrough,
|
|
|
+ ),
|
|
|
+ modifier = Modifier.padding(bottom = 2.dp),
|
|
|
+
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HomeCourseRecommendItemTag() {
|
|
|
+ Text(
|
|
|
+ text = "0-3岁",
|
|
|
+ style = TextStyle(
|
|
|
+ fontSize = 10.sp,
|
|
|
+ lineHeight = 14.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ color = Colors.from("#FF0B57C7"),
|
|
|
+ ),
|
|
|
+
|
|
|
+ modifier = Modifier
|
|
|
+ .border(
|
|
|
+ width = 0.5.dp,
|
|
|
+ color = Colors.from("#FF0B57C7"),
|
|
|
+ shape = RoundedCornerShape(20.dp)
|
|
|
+ )
|
|
|
+ .padding(vertical = 1.dp, horizontal = 6.dp),
|
|
|
+ )
|
|
|
}
|