Skip to content

Commit

Permalink
mod: #6 null 체크 let 함수 ?:로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyobeen-Park committed May 2, 2024
1 parent 25df58c commit 1de9d99
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions app/src/main/java/com/sopt/now/compose/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,23 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@Composable
fun HomeScreen(nickname: String?, mbti: String?){
fun HomeScreen(nickname: String?, mbti: String?) {
val homeViewModel = HomeViewModel()
val friendsList = homeViewModel.getFriendsData()

LazyColumn {
item {
nickname?.let {
mbti?.let { it1 ->
UserItem(
painter = R.drawable.ic_launcher_foreground,
contentDescription = "User Profile Image",
imageSize = 70.dp,
nickname = it,
mbti = it1,
fontSize = 24.sp
)
}
}
UserItem(
painter = R.drawable.ic_launcher_foreground,
contentDescription = "User Profile Image",
imageSize = 70.dp,
nickname = nickname ?: "닉네임",
mbti = mbti ?: "mbti",
fontSize = 24.sp
)
}

items(friendsList) {friendsList ->
items(friendsList) { friendsList ->
UserItem(
painter = friendsList.profileImage,
contentDescription = "Friends profile image",
Expand Down

0 comments on commit 1de9d99

Please sign in to comment.