yayan 1 year ago
parent
commit
0089460644
1 changed files with 54 additions and 8 deletions
  1. 54 8
      app/src/main/java/io/nexilis/alpha/ui/main/Chat.kt

+ 54 - 8
app/src/main/java/io/nexilis/alpha/ui/main/Chat.kt

@@ -14,8 +14,12 @@ import androidx.compose.material.icons.Icons
 import androidx.compose.material.icons.automirrored.filled.Send
 import androidx.compose.material.icons.filled.AccessTime
 import androidx.compose.material.icons.filled.Add
+import androidx.compose.material.icons.filled.AttachFile
+import androidx.compose.material.icons.filled.AudioFile
+import androidx.compose.material.icons.filled.Camera
 import androidx.compose.material.icons.filled.Done
 import androidx.compose.material.icons.filled.DoneAll
+import androidx.compose.material.icons.filled.Image
 import androidx.compose.material3.*
 import androidx.compose.runtime.*
 import androidx.compose.runtime.livedata.observeAsState
@@ -188,14 +192,7 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
                 Text(text = "Typing here...", color = MaterialTheme.colorScheme.onSurface)
             },
             leadingIcon = {
-                IconButton(onClick = { }
-                ) {
-                    Icon(
-                        imageVector = Icons.Default.Add,
-                        contentDescription = "",
-                        tint = MaterialTheme.colorScheme.primary
-                    )
-                }
+                Attachments()
             },
             trailingIcon = {
                 Row {
@@ -246,4 +243,53 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
             maxLines = 3
         )
     }
+}
+
+@Composable
+fun Attachments() {
+    var isOpenMenu by remember {
+        mutableStateOf(false)
+    }
+    IconButton(onClick = {
+        isOpenMenu = !isOpenMenu
+    }
+    ) {
+        Icon(
+            imageVector = Icons.Default.Add,
+            contentDescription = "",
+            tint = MaterialTheme.colorScheme.primary
+        )
+    }
+    DropdownMenu(
+        expanded = isOpenMenu,
+        onDismissRequest = { isOpenMenu = false }) {
+        DropdownMenuItem(
+            text = { Text(text = "Camera") },
+            onClick = { },
+            leadingIcon = {
+                Icon(imageVector = Icons.Default.Camera, contentDescription = "")
+            }
+        )
+        DropdownMenuItem(
+            text = { Text(text = "Gallery") },
+            onClick = { },
+            leadingIcon = {
+                Icon(imageVector = Icons.Default.Image, contentDescription = "")
+            }
+        )
+        DropdownMenuItem(
+            text = { Text(text = "Documents") },
+            onClick = { },
+            leadingIcon = {
+                Icon(imageVector = Icons.Default.AttachFile, contentDescription = "")
+            }
+        )
+        DropdownMenuItem(
+            text = { Text(text = "Audio") },
+            onClick = { },
+            leadingIcon = {
+                Icon(imageVector = Icons.Default.AudioFile, contentDescription = "")
+            }
+        )
+    }
 }