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

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.material.Switch
import androidx.compose.material.SwitchDefaults
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
import com.ys.bdtp.adm.app.theme.blueColor
import com.ys.bdtp.adm.app.theme.textBlackColor
import com.ys.bdtp.adm.app.theme.textBlueColor
import com.ys.bdtp.adm.app.theme.trBgColor

@Composable
fun CadDrawingItem() {
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .height(48.dp)
            .background(trBgColor),
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.SpaceAround

    ) {
        Text(
            text = "xxxxxxxxx.dwg",
            fontSize = 16.sp,
            color = textBlackColor,
            textAlign = TextAlign.Center,
            maxLines = 1,
            modifier = Modifier.weight(4f)
        )
        Text(
            text = "10条",
            fontSize = 16.sp,
            color = textBlackColor,
            textAlign = TextAlign.Center,
            maxLines = 1,
            modifier = Modifier.weight(2f)
        )
        Text(
            text = "1处",
            fontSize = 16.sp,
            color = textBlackColor,
            textAlign = TextAlign.Center,
            maxLines = 1,
            modifier = Modifier.weight(2f)
        )
        Text(
            text = "打开图纸核查",
            fontSize = 16.sp,
            color = textBlueColor,
            textAlign = TextAlign.Center,
            maxLines = 1,
            modifier = Modifier.weight(3f)
        )

        Switch(
            checked = true,
            onCheckedChange = {},
            modifier = Modifier.weight(2f),
            colors = SwitchDefaults.colors(
                checkedThumbColor = blueColor,
                checkedTrackColor = blueColor,
                uncheckedThumbColor = Color(0xFFE5E5E5),
                uncheckedTrackColor = Color(0xFFE5E5E5)
            )
        )

        Text(
            text = "完成",
            fontSize = 16.sp,
            color = textBlueColor,
            textAlign = TextAlign.Center,
            maxLines = 1,
            modifier = Modifier.weight(2f)
        )
    }

}

@Preview(widthDp = 900)
@Composable
fun PreviewCadDrawingItem() {
    CadDrawingItem()
}