|
@@ -0,0 +1,637 @@
|
|
|
+package com.zaojiao.app.feat.home.plan.index
|
|
|
+
|
|
|
+import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
+import androidx.compose.foundation.background
|
|
|
+import androidx.compose.foundation.border
|
|
|
+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.aspectRatio
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
+import androidx.compose.foundation.layout.fillMaxSize
|
|
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
+import androidx.compose.foundation.layout.height
|
|
|
+import androidx.compose.foundation.layout.heightIn
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.size
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
+import androidx.compose.foundation.layout.wrapContentSize
|
|
|
+import androidx.compose.foundation.lazy.LazyColumn
|
|
|
+import androidx.compose.foundation.lazy.LazyRow
|
|
|
+import androidx.compose.foundation.pager.HorizontalPager
|
|
|
+import androidx.compose.foundation.pager.rememberPagerState
|
|
|
+import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
+import androidx.compose.material3.Text
|
|
|
+import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.getValue
|
|
|
+import androidx.compose.runtime.mutableStateOf
|
|
|
+import androidx.compose.runtime.remember
|
|
|
+import androidx.compose.runtime.setValue
|
|
|
+import androidx.compose.ui.Alignment
|
|
|
+import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.draw.clip
|
|
|
+import androidx.compose.ui.draw.drawWithContent
|
|
|
+import androidx.compose.ui.geometry.Offset
|
|
|
+import androidx.compose.ui.geometry.Rect
|
|
|
+import androidx.compose.ui.graphics.Brush
|
|
|
+import androidx.compose.ui.graphics.Color
|
|
|
+import androidx.compose.ui.graphics.Path
|
|
|
+import androidx.compose.ui.graphics.drawscope.Stroke
|
|
|
+import androidx.compose.ui.layout.onGloballyPositioned
|
|
|
+import androidx.compose.ui.layout.onPlaced
|
|
|
+import androidx.compose.ui.platform.LocalDensity
|
|
|
+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 androidx.hilt.navigation.compose.hiltViewModel
|
|
|
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
+import com.zaojiao.app.data.model.studyplan.StudyPlanTodayModel
|
|
|
+import com.zaojiao.app.data.model.studyplan.StudyPlanTomorrowModel
|
|
|
+import com.zaojiao.app.feat.design.Colors
|
|
|
+import com.zaojiao.app.feat.design.Expanded
|
|
|
+import com.zaojiao.app.feat.design.Images
|
|
|
+import com.zaojiao.app.feat.design.Spacer
|
|
|
+import com.zaojiao.app.feat.design.StatePage
|
|
|
+import com.zaojiao.app.feat.home.R
|
|
|
+import com.zaojiao.app.feat.home.plan.state.HomePlanIndexUiState
|
|
|
+
|
|
|
+@OptIn(ExperimentalFoundationApi::class)
|
|
|
+@Composable
|
|
|
+internal fun HomePlanIndexPage(
|
|
|
+ viewModel: HomePlanIndexViewModel = hiltViewModel()
|
|
|
+) {
|
|
|
+ val uiState by viewModel.stateFlow.collectAsStateWithLifecycle()
|
|
|
+
|
|
|
+
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize(),
|
|
|
+ ) {
|
|
|
+ StatePage(uiState = uiState) { state ->
|
|
|
+ var bodyHeight by remember { mutableStateOf(2000) }
|
|
|
+ var tabHeight by remember { mutableStateOf(0) }
|
|
|
+
|
|
|
+ val historyCategory = state.historyCategory
|
|
|
+ val historyPlanList = state.historyPlanList
|
|
|
+
|
|
|
+ LazyColumn(modifier = Modifier
|
|
|
+ .onPlaced { bodyHeight = it.size.height }
|
|
|
+ .fillMaxSize()) {
|
|
|
+ if (state == HomePlanIndexUiState.logout) {
|
|
|
+ item {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(vertical = 60.dp)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .wrapContentHeight(),
|
|
|
+ ) {
|
|
|
+ Images.Resource(
|
|
|
+ id = R.mipmap.study_plan_no_item,
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.CenterHorizontally)
|
|
|
+ .size(172.dp, 140.dp),
|
|
|
+ )
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = "当前还未购买,快点来购买吧!",
|
|
|
+ modifier = Modifier.align(Alignment.CenterHorizontally)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (state.tomorrowPlanList.isNotEmpty()) {
|
|
|
+ item {
|
|
|
+ HomePlanIndexTomorrow(
|
|
|
+ tomorrowPlanList = state.tomorrowPlanList,
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ item {
|
|
|
+ Box(modifier = Modifier.height(20.dp))
|
|
|
+ }
|
|
|
+
|
|
|
+ item {
|
|
|
+ HomePlanIndexToday(
|
|
|
+ todayPlanList = state.todayPlanList,
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ item {
|
|
|
+ Box(modifier = Modifier.height(25.dp))
|
|
|
+ }
|
|
|
+
|
|
|
+ item {
|
|
|
+ HomePlanIndexHistoryTitle()
|
|
|
+ }
|
|
|
+
|
|
|
+ item {
|
|
|
+ Box(modifier = Modifier.height(10.dp))
|
|
|
+ }
|
|
|
+
|
|
|
+ stickyHeader {
|
|
|
+ HomePlanIndexHistoryTab(
|
|
|
+ historyCategory = state.historyCategory,
|
|
|
+ onChoose = viewModel::selectCategory,
|
|
|
+ modifier = Modifier
|
|
|
+ .onGloballyPositioned {
|
|
|
+ tabHeight = it.size.height
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ item {
|
|
|
+ val height = bodyHeight - tabHeight
|
|
|
+
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .heightIn(
|
|
|
+ min = (height / LocalDensity.current.density).dp
|
|
|
+ ),
|
|
|
+ ) {
|
|
|
+ Spacer(height = 6.dp)
|
|
|
+ repeat(historyPlanList.size) {
|
|
|
+ val historyModel = historyPlanList[it]
|
|
|
+
|
|
|
+ HomePlanIndexHistoryItem(historyModel)
|
|
|
+ }
|
|
|
+ Spacer(height = 6.dp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@OptIn(ExperimentalFoundationApi::class)
|
|
|
+@Composable
|
|
|
+private fun HomePlanIndexTomorrow(
|
|
|
+ tomorrowPlanList: List<StudyPlanTomorrowModel>
|
|
|
+) {
|
|
|
+ val count = tomorrowPlanList.size
|
|
|
+ val pagerState = rememberPagerState()
|
|
|
+
|
|
|
+ HorizontalPager(
|
|
|
+ pageCount = count,
|
|
|
+ state = pagerState,
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 16.dp)
|
|
|
+ .clip(RoundedCornerShape(35.dp))
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(70.dp)
|
|
|
+ ) {
|
|
|
+ HomePlanTomorrowItem(tomorrowPlanList[it])
|
|
|
+ }
|
|
|
+
|
|
|
+ if (count > 1) {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(top = 8.dp)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(4.dp),
|
|
|
+ horizontalArrangement = Arrangement.Center,
|
|
|
+ ) {
|
|
|
+ repeat(count) {
|
|
|
+ if (it == pagerState.currentPage) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 2.dp)
|
|
|
+ .background(
|
|
|
+ color = Colors.from("#d8d8d8"),
|
|
|
+ shape = RoundedCornerShape(2.dp),
|
|
|
+ )
|
|
|
+ .fillMaxHeight()
|
|
|
+ .width(16.dp),
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 2.dp)
|
|
|
+ .background(
|
|
|
+ color = Colors.from("#d8d8d8"),
|
|
|
+ shape = RoundedCornerShape(2.dp),
|
|
|
+ )
|
|
|
+ .height(4.dp)
|
|
|
+ .width(4.dp),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+private fun HomePlanIndexToday(
|
|
|
+ todayPlanList: List<StudyPlanTodayModel>
|
|
|
+) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 16.dp)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(227.dp),
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .background(
|
|
|
+ brush = Brush.horizontalGradient(
|
|
|
+ colors = listOf(
|
|
|
+ Colors.from("#EBFEE6D5"),
|
|
|
+ Colors.from("#FFFFE7D6"),
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ shape = RoundedCornerShape(20.dp),
|
|
|
+ )
|
|
|
+ .fillMaxSize()
|
|
|
+ )
|
|
|
+
|
|
|
+ Column(
|
|
|
+ modifier = Modifier.fillMaxSize(),
|
|
|
+ ) {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 12.dp, vertical = 20.dp)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .wrapContentHeight(),
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ text = "今日计划",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ fontSize = 20.sp,
|
|
|
+ lineHeight = 28.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
+ Spacer(width = 6.dp)
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = "共${todayPlanList.size}节",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ fontSize = 11.sp,
|
|
|
+ lineHeight = 12.sp,
|
|
|
+ ),
|
|
|
+ modifier = Modifier
|
|
|
+ .background(
|
|
|
+ color = Colors
|
|
|
+ .from("#FFFF8024")
|
|
|
+ .copy(alpha = 0.2f), shape = RoundedCornerShape(
|
|
|
+ topStart = 15.dp,
|
|
|
+ bottomStart = 2.dp,
|
|
|
+ topEnd = 15.dp,
|
|
|
+ bottomEnd = 15.dp,
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .padding(horizontal = 7.dp, vertical = 3.dp)
|
|
|
+ .wrapContentSize(),
|
|
|
+ )
|
|
|
+
|
|
|
+ Expanded()
|
|
|
+ Text(
|
|
|
+ text = "计划日历",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ LazyRow(
|
|
|
+ modifier = Modifier
|
|
|
+ .weight(1f)
|
|
|
+ .fillMaxWidth(),
|
|
|
+ ) {
|
|
|
+ item {
|
|
|
+ Box(modifier = Modifier.width(6.dp))
|
|
|
+ }
|
|
|
+ todayPlanList.forEach {
|
|
|
+ item {
|
|
|
+ HomePlanTodayItem(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item {
|
|
|
+ Box(modifier = Modifier.width(6.dp))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Spacer(height = 20.dp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+private fun HomePlanTomorrowItem(tomorrow: StudyPlanTomorrowModel) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .clip(RoundedCornerShape(35.dp))
|
|
|
+ .fillMaxSize(),
|
|
|
+ ) {
|
|
|
+ Images.Color(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ description = "",
|
|
|
+ modifier = Modifier.fillMaxSize(),
|
|
|
+ )
|
|
|
+
|
|
|
+ Row(modifier = Modifier.fillMaxSize()) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(6.dp)
|
|
|
+ .border(
|
|
|
+ width = 1.dp,
|
|
|
+ color = Color.White,
|
|
|
+ shape = RoundedCornerShape(35.dp),
|
|
|
+ )
|
|
|
+ .clip(RoundedCornerShape(35.dp))
|
|
|
+ .aspectRatio(ratio = 1f),
|
|
|
+ ) {
|
|
|
+ Images.Network(
|
|
|
+ url = tomorrow.courseItemImgCover, modifier = Modifier.fillMaxSize()
|
|
|
+ )
|
|
|
+
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .background(color = Colors.from("#36000000"))
|
|
|
+ .fillMaxSize(),
|
|
|
+ )
|
|
|
+
|
|
|
+ Images.Resource(
|
|
|
+ id = R.mipmap.study_plan_lock_white,
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.Center)
|
|
|
+ .size(26.dp),
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.CenterVertically)
|
|
|
+ .weight(1f)
|
|
|
+ .padding(horizontal = 9.dp)
|
|
|
+ .wrapContentHeight()
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ text = tomorrow.courseName,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Color.White,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ Spacer(height = 6.dp)
|
|
|
+ Text(
|
|
|
+ text = tomorrow.courseItemName,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Color.White,
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ fontSize = 18.sp,
|
|
|
+ lineHeight = 21.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.CenterVertically)
|
|
|
+ .background(
|
|
|
+ color = Colors.from("#CDFFFFFF"),
|
|
|
+ shape = RoundedCornerShape(20.dp),
|
|
|
+ )
|
|
|
+ .padding(
|
|
|
+ start = 12.dp,
|
|
|
+ top = 7.dp,
|
|
|
+ end = 9.dp,
|
|
|
+ bottom = 6.dp,
|
|
|
+ )
|
|
|
+ .wrapContentSize()
|
|
|
+ ) {
|
|
|
+ if (tomorrow.tomorrowUnlock) {
|
|
|
+ Text(
|
|
|
+ text = "明日解锁",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 12.sp,
|
|
|
+ lineHeight = 12.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ Text(
|
|
|
+ text = "${tomorrow.unlockDate.substring(0, 5)}解锁",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.from("#FFFF8024"),
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 12.sp,
|
|
|
+ lineHeight = 12.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Spacer(width = 16.dp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+private fun HomePlanTodayItem(today: StudyPlanTodayModel) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(horizontal = 6.dp)
|
|
|
+ .fillMaxHeight()
|
|
|
+ .width(262.dp),
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(top = 20.dp)
|
|
|
+ .background(
|
|
|
+ color = Color.White, shape = RoundedCornerShape(20.dp)
|
|
|
+ )
|
|
|
+ .fillMaxHeight()
|
|
|
+ .fillMaxWidth()
|
|
|
+ )
|
|
|
+
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 9.dp, bottom = 9.dp)
|
|
|
+ .align(Alignment.TopStart)
|
|
|
+ .border(
|
|
|
+ width = 3.dp, color = Color.White, shape = RoundedCornerShape(14.dp)
|
|
|
+ )
|
|
|
+ .background(
|
|
|
+ color = Color.Green.copy(alpha = 0.3f),
|
|
|
+ shape = RoundedCornerShape(14.dp),
|
|
|
+ )
|
|
|
+ .fillMaxHeight()
|
|
|
+ .width(96.dp)
|
|
|
+ ) {
|
|
|
+ Images.Network(
|
|
|
+ url = today.courseItemImgCover,
|
|
|
+ modifier = Modifier
|
|
|
+ .clip(RoundedCornerShape(14.dp))
|
|
|
+ .fillMaxSize(),
|
|
|
+ )
|
|
|
+
|
|
|
+ Text(
|
|
|
+ text = today.courseCategoryName,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Color.White,
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ fontSize = 10.sp,
|
|
|
+ lineHeight = 10.sp,
|
|
|
+ ),
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.TopStart)
|
|
|
+ .padding(3.dp)
|
|
|
+ .drawWithContent {
|
|
|
+ this.drawContent()
|
|
|
+ val radius = 3.dp.toPx()
|
|
|
+ val radius2 = 6.dp.toPx()
|
|
|
+
|
|
|
+ val width = this.size.width
|
|
|
+ val height = this.size.height
|
|
|
+
|
|
|
+ val path = Path().apply {
|
|
|
+ moveTo(width + radius, 0f)
|
|
|
+ arcTo(
|
|
|
+ rect = Rect(
|
|
|
+ center = Offset(width + radius, radius),
|
|
|
+ radius = radius,
|
|
|
+ ),
|
|
|
+ startAngleDegrees = -100f,
|
|
|
+ sweepAngleDegrees = -90f,
|
|
|
+ forceMoveTo = true,
|
|
|
+ )
|
|
|
+ lineTo(width, height - radius)
|
|
|
+ arcTo(
|
|
|
+ rect = Rect(
|
|
|
+ center = Offset(width - radius2, height - radius2),
|
|
|
+ radius = radius2,
|
|
|
+ ),
|
|
|
+ startAngleDegrees = 0f,
|
|
|
+ sweepAngleDegrees = 80f,
|
|
|
+ forceMoveTo = true,
|
|
|
+ )
|
|
|
+ lineTo(radius / 2, height)
|
|
|
+ arcTo(
|
|
|
+ rect = Rect(
|
|
|
+ center = Offset(radius / 2, height + radius),
|
|
|
+ radius = radius,
|
|
|
+ ),
|
|
|
+ startAngleDegrees = -90f,
|
|
|
+ sweepAngleDegrees = -90f,
|
|
|
+ forceMoveTo = true,
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ this.drawPath(
|
|
|
+ path = path, color = Color.White, style = Stroke(
|
|
|
+ width = 3.dp.toPx(),
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ .background(
|
|
|
+ color = Colors.from("#FFFF8024"), shape = RoundedCornerShape(
|
|
|
+ topStart = 10.dp,
|
|
|
+ bottomStart = 4.dp,
|
|
|
+ topEnd = 0.dp,
|
|
|
+ bottomEnd = 0.dp,
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .padding(horizontal = 7.dp, vertical = 3.dp)
|
|
|
+ .wrapContentSize(),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(
|
|
|
+ start = 117.dp,
|
|
|
+ top = 20.dp,
|
|
|
+ end = 12.dp,
|
|
|
+ )
|
|
|
+ .fillMaxHeight()
|
|
|
+ .fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Spacer(height = 15.dp)
|
|
|
+ Text(
|
|
|
+ text = today.courseName,
|
|
|
+ overflow = TextOverflow.Ellipsis,
|
|
|
+ maxLines = 1,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.FF666666,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ Spacer(height = 5.dp)
|
|
|
+ Text(
|
|
|
+ text = today.courseItemName,
|
|
|
+ overflow = TextOverflow.Ellipsis,
|
|
|
+ maxLines = 1,
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.FF333333,
|
|
|
+ fontWeight = FontWeight.Medium,
|
|
|
+ fontSize = 18.sp,
|
|
|
+ lineHeight = 21.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ Spacer(height = 8.dp)
|
|
|
+
|
|
|
+ if (today.unlockState) {
|
|
|
+ Row() {
|
|
|
+ repeat(today.totalTask) {
|
|
|
+ if (it != 0) {
|
|
|
+ Spacer(width = 8.dp)
|
|
|
+ }
|
|
|
+ if (it < today.completeTaskNum) {
|
|
|
+ Images.Resource(
|
|
|
+ id = R.mipmap.study_plan_light_on,
|
|
|
+ modifier = Modifier
|
|
|
+ .width(17.dp)
|
|
|
+ .height(22.dp),
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ Images.Resource(
|
|
|
+ id = R.mipmap.study_plan_light_off,
|
|
|
+ modifier = Modifier
|
|
|
+ .width(17.dp)
|
|
|
+ .height(22.dp),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Row() {
|
|
|
+ Images.Resource(
|
|
|
+ id = R.mipmap.study_plan_lock,
|
|
|
+ modifier = Modifier
|
|
|
+ .width(16.dp)
|
|
|
+ .height(16.dp),
|
|
|
+ )
|
|
|
+ Spacer(width = 4.dp)
|
|
|
+ Text(
|
|
|
+ text = "${today.unlockTime}解锁",
|
|
|
+ style = TextStyle(
|
|
|
+ color = Colors.FF333333,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ lineHeight = 16.sp,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|