package com.ys.bdtp.adm.mvvm.ui.screen.task

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
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.shape.RoundedCornerShape
import androidx.compose.material.LinearProgressIndicator
import androidx.compose.material.Surface
import androidx.compose.material.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.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@Composable
fun TaskItem() {
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .height(60.dp)
            .background(Color.White),
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.SpaceEvenly
    ) {
        Text(
            text = "项目名称",
            fontSize = 16.sp,
            color = Color(0xFF1F2429),
            textAlign = TextAlign.Center,
            modifier = Modifier.weight(3f)
        )
        Text(
            text = "楼层",
            fontSize = 16.sp,
            color = Color(0xFF1F2429),
            textAlign = TextAlign.Center,
            modifier = Modifier.weight(2f)
        )
        Text(
            text = "起始时间",
            fontSize = 16.sp,
            color = Color(0xFF1F2429),
            textAlign = TextAlign.Center,
            modifier = Modifier.weight(2f)
        )

        Row(modifier = Modifier.fillMaxWidth().weight(3f).padding(16.dp)) {
            Surface(
                elevation = 0.dp,
                shape = RoundedCornerShape(10.dp),
                modifier = Modifier.weight(3f).height(10.dp),
            ) {

                LinearProgressIndicator(
                    progress = 0.8f,
                    color = Color(0xFF0091FF),
                    backgroundColor = Color(0xFFF9F9F9),
                )
            }
        }

        Text(
            text = "40%",
            fontSize = 16.sp,
            color = Color(0xFF1F2429),
            textAlign = TextAlign.Center,
            modifier = Modifier.weight(2f)
        )
    }
}

@Preview(widthDp = 1137)
@Composable
fun PreviewProjectRecentTaskItem() {
    TaskItem()
}