[팀프로젝트] 대학생 조별과제를 위한 그룹웨어 앱 개발

Jean·2023년 8월 31일
1

대학생 조별과제를 위한 그룹웨어 앱 개발

나는 홈화면 레이아웃을 짜고 컬러와 디자인을 맡았다.

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen(navController: NavController) {
    val nanumbarngothic = FontFamily(
        Font(R.font.nanumbarungothic, FontWeight.Normal, FontStyle.Normal),
        Font(R.font.nanumbarungothicbold, FontWeight.Bold, FontStyle.Normal),
        Font(R.font.nanumbarungothiclight, FontWeight.Light, FontStyle.Normal),
        Font(R.font.nanumbarungothicultralight, FontWeight.Thin, FontStyle.Normal)
    )
   
    Scaffold(
        topBar = {
            TopAppBar(
                title = { Text(text = "Home", color = Color.White, fontWeight = FontWeight.Bold) },
                //탑바 색바꾸기
                colors = TopAppBarDefaults.smallTopAppBarColors(
                    containerColor = Color(0xff75D1FF)
                ),
                actions = {
                    Row {
                        IconButton(onClick = { navController.navigate("timer") }) {
                            Image(
                                painter = painterResource(id = R.drawable.baseline_timer_24),
                                contentDescription = null,
                                modifier = Modifier.size(35.dp)
                            )
                        }
//                        IconButton(onClick = { }) {
//                            Image(
//                                painter = painterResource(id = R.drawable.baseline_post_add_24),
//                                contentDescription = null,
//                                modifier = Modifier.size(35.dp)
//                            )
//                        }
                    }
                }
            )
        },
        bottomBar = {
            MyBottomBar(navController)
        }
    ) { innerPadding ->
        Surface(
            modifier = Modifier
                .fillMaxSize()
                .padding(innerPadding), color = Color.White
        ) {
            LazyColumn {
                item {
                    HomeTitle(categorytitle = "게시판", fontFamily = nanumbarngothic)
                    Divider()
                    Row {
                        HomeBoardTitle(
                            icon = R.drawable.baseline_announcement_24,
                            boardtitle = "공지사항",
                            onClicked = { navController.navigate("notice") })
                    }
                    HomeTitle(categorytitle = "과제 진행상황 공유", fontFamily = nanumbarngothic)
                    Divider()
                    Row {
                        HomeBoardTitle(
                            icon = R.drawable.baseline_insert_drive_file_24,
                            boardtitle = "데이터마이닝",
                            onClicked = { navController.navigate("Data Mining") })
                        HomeBoardTitle(
                            icon = R.drawable.baseline_insert_drive_file_24,
                            boardtitle = "인공지능 시스템구조",
                            onClicked = { navController.navigate("AI System Architecture") })
                    }
                    Row {
                        HomeBoardTitle(
                            icon = R.drawable.baseline_insert_drive_file_24,
                            boardtitle = "컴퓨터 그래픽스",
                            onClicked = { navController.navigate("Computer Graphics") })
                        HomeBoardTitle(
                            icon = R.drawable.baseline_insert_drive_file_24,
                            boardtitle = "객체지향 프로그래밍",
                            onClicked = { navController.navigate("Object Oriented Programming") })
                    }
                    Row {
                        HomeBoardTitle(
                            icon = R.drawable.baseline_insert_drive_file_24,
                            boardtitle = "컴퓨터 보안",
                            onClicked = { navController.navigate("Computer Security") })
                    }
                    Divider()
                    Row {
                        HomeBoardTitle(
                            icon = R.drawable.baseline_fastfood_24_wb,
                            boardtitle = "점심 게시판",
                            onClicked = { navController.navigate("lunchMenuScreenRoute") })
                    }
                }
            }
        }
    }
}

@Composable
fun HomeBoardTitle(icon: Int, boardtitle: String, onClicked: () -> Unit) {
    val nanumbarngothic = FontFamily(
        Font(R.font.nanumbarungothic, FontWeight.Normal, FontStyle.Normal),
        Font(R.font.nanumbarungothicbold, FontWeight.Bold, FontStyle.Normal),
        Font(R.font.nanumbarungothiclight, FontWeight.Light, FontStyle.Normal),
        Font(R.font.nanumbarungothicultralight, FontWeight.Thin, FontStyle.Normal)
    )
    Box(
        modifier = Modifier
            .padding(horizontal = 12.dp, vertical = 8.dp)
            .background(Color.White)
            .clickable { onClicked() }
            .border(1.dp, Color.Gray, shape = RoundedCornerShape(8.dp))
            .size(width = 178.dp, height = 128.dp),
    ) {
        Column(
            verticalArrangement = Arrangement.Center,
            horizontalAlignment = Alignment.Start,
            modifier = Modifier
                .padding(start = 14.dp, top = 8.dp)
        ) {
            Image(
                painter = painterResource(id = icon),
                contentDescription = null,
                modifier = Modifier
                    .size(32.dp)
            )
            Spacer(modifier = Modifier.height(32.dp))
            Text(
                text = boardtitle,
                color = Color.DarkGray,
                fontSize = 16.sp,
                fontFamily = nanumbarngothic,
                fontWeight = FontWeight.Normal
            )
        }
    }
}

//@Composable
//@OptIn(ExperimentalMaterial3Api::class)
//fun NewBoardScreen() {
//    var name by remember { mutableStateOf("") }
//    val nanumbarngothic = FontFamily(
//        Font(R.font.nanumbarungothic, FontWeight.Normal, FontStyle.Normal),
//        Font(R.font.nanumbarungothicbold, FontWeight.Bold, FontStyle.Normal),
//        Font(R.font.nanumbarungothiclight, FontWeight.Light, FontStyle.Normal),
//        Font(R.font.nanumbarungothicultralight, FontWeight.Thin, FontStyle.Normal)
//    )
//    Column {
//        TextField(
//            value = name,
//            onValueChange = { name = it },
//            label = { Text(text = "새로운 게시판 이름") },
//            placeholder = { Text(text = "") }
//        )
//        Button(onClick = {
//            val newBoardIcon = R.drawable.baseline_insert_drive_file_24
//            val newBoardTitle = name
//            val newBoard = Pair(newBoardIcon, newBoardTitle)
//        }) {
//            Text(text = "생성")
//        }
//    }
//}

@Composable
fun HomeTitle(categorytitle: String, fontFamily: FontFamily) {
    Text(
        text = categorytitle,
        fontFamily = fontFamily,
        fontWeight = FontWeight.Bold,
        fontSize = 20.sp,
        modifier = Modifier.padding(10.dp),
        color = Color.DarkGray
    )
}```

newboardscreen 함수로 새로운 게시판을 만드려고 했다.
onClick하면 텍스트를 입력받아 새로운 HomeBoardTitle이 Column으로 생겼으면 했는데 구현하기가 어려웠다. 
이것까지 했으면 좋았을텐데 아쉽당...


profile
아 왜 안돼

1개의 댓글

comment-user-thumbnail
2023년 9월 19일

여러 사람들과 협업해서 팀프로젝트를 진행하는 모습 머찌네용

답글 달기