Browse Source

@fun: task

bai 3 years ago
parent
commit
eb7b87c382

+ 69 - 0
app/src/main/java/com/ys/bdtp/adm/mvvm/ui/screen/task/TaskHeadLeft.kt

@@ -0,0 +1,69 @@
+package com.ys.bdtp.adm.mvvm.ui.screen.task
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.*
+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.res.painterResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.ys.bdtp.adm.R
+
+
+@Composable
+fun TaskHeadLeft(
+    title: String,
+    click: () -> Unit
+) {
+    Row(
+        verticalAlignment = Alignment.CenterVertically,
+        horizontalArrangement = Arrangement.Start
+    ) {
+
+        Spacer(modifier = Modifier.width(32.dp))
+
+        Image(
+            painter = painterResource(R.drawable.arrow_back),
+            contentDescription = "",
+            modifier = Modifier.size(24.dp)
+        )
+
+        Spacer(
+            modifier = Modifier.width(16.dp)
+        )
+
+        Spacer(
+            modifier = Modifier
+                .width(1.dp)
+                .height(16.dp)
+                .background(Color(0xFFD8D8D8))
+        )
+
+        Spacer(
+            modifier = Modifier.width(16.dp)
+        )
+
+        Row(
+            modifier = Modifier.clickable {
+                click()
+            }
+        ) {
+            Text(text = title, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = Color(0xFF1F2329))
+
+            Spacer(modifier = Modifier.width(16.dp))
+
+            Image(
+                painter = painterResource(R.drawable.arrow_down),
+                contentDescription = "",
+                modifier = Modifier.size(16.dp)
+            )
+        }
+
+    }
+}

+ 15 - 3
app/src/main/java/com/ys/bdtp/adm/mvvm/ui/screen/task/TaskScreen.kt

@@ -19,16 +19,21 @@ import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
 import com.ys.bdtp.adm.R
+import com.ys.bdtp.adm.mvvm.model.db.entity.ProjectEntity
 import com.ys.bdtp.adm.mvvm.ui.compose.Head
 import com.ys.bdtp.adm.mvvm.ui.compose.TaskType
 import com.ys.bdtp.adm.mvvm.ui.compose.HeadLeft
 import com.ys.bdtp.adm.mvvm.ui.compose.HeadRight
 
 @Composable
-fun TaskScreen() {
+fun TaskScreen(project: ProjectEntity) {
     Column(modifier = Modifier.fillMaxSize().background(Color.White)) {
         Head(
-            left = { HeadLeft() },
+            left = {
+                TaskHeadLeft(
+                    title = project.projectName,
+                    click = {})
+            },
             right = {
                 HeadRight(
                     role = { "管家" },
@@ -90,5 +95,12 @@ fun TaskScreen() {
 )
 @Composable
 fun PreviewProjectScreen() {
-    TaskScreen()
+    TaskScreen(
+        ProjectEntity(
+            projectId = "111",
+            projectName = "京东",
+            groupCode = "GD",
+            groupName = "京东"
+        )
+    )
 }

app/src/main/java/com/ys/bdtp/adm/mvvm/ui/compose/TaskType.kt → app/src/main/java/com/ys/bdtp/adm/mvvm/ui/screen/task/TaskType.kt