Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDLE-471] 말풍선 메세지가 너무 길 경우 더보기 버튼 추가 및 전체 채팅 보기 화면 추가 #147

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

tgyuuAn
Copy link
Member

@tgyuuAn tgyuuAn commented Nov 4, 2024

1. 🔥 변경된 내용

  • 채팅 말풍선에서 텍스트가 긴 메세지일 경우 말줄임 및 전체보기 버튼 생기도록 변경
  • 채팅 모두 보기 화면 추가 및 네비게이션 연결

2. 📸 스크린샷(선택)

2024-11-04.5.09.34.mov

image

3. 💡 알게된 부분

Column(modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp)) {
    val chatContents = chatMessage.contents.joinToString { it.value }
    var hasOverflow by remember { mutableStateOf(false) }

    Text(
        text = chatContents,
        style = CareTheme.typography.body3,
        color = CareTheme.colors.white000,
        maxLines = 10,
        onTextLayout = { textLayoutResult ->
            hasOverflow = textLayoutResult.hasVisualOverflow
        },
    )

    if (hasOverflow) {
        Row(
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.SpaceBetween,
            modifier = Modifier
                .fillMaxWidth()
                .padding(top = 10.dp)
                .clickable { onSeeAllChatClicked(chatContents) },
        ) {
            Text(
                text = "전체보기",
                style = CareTheme.typography.caption1,
                color = CareTheme.colors.white000,
            )

            Image(
                painter = painterResource(com.idle.designresource.R.drawable.ic_arrow_left_small),
                colorFilter = ColorFilter.tint(CareTheme.colors.white000),
                contentDescription = null,
            )
        }
    }
}

Text 컴포저블의 onTextLayout 을 이용하여 overFlow가 났는지, 혹은 현재 몇 줄을 차지하고 있는지,
너비를 넘었는지 높이를 넘었는 지 등을 파악할 수 있음.




rememberListState를 이용하여 네비게이션이 되어서 돌아와도 이전 스크롤을 유지할 수 있음.

@tgyuuAn tgyuuAn added 기능 ⚒️ 새로운 기능 구현 ⚒️ 새롭게 알게 됨 📖 나 tgyuu가 새롭게 알게된 부분 📖 UI/UX 🎨 디자인 시스템, 디자인 리소스 관련 코드 🎨 labels Nov 4, 2024
@tgyuuAn tgyuuAn self-assigned this Nov 4, 2024
@tgyuuAn tgyuuAn merged commit 3544431 into develop Nov 4, 2024
1 check passed
@tgyuuAn tgyuuAn deleted the feature/IDLE-471 branch November 4, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI/UX 🎨 디자인 시스템, 디자인 리소스 관련 코드 🎨 기능 ⚒️ 새로운 기능 구현 ⚒️ 새롭게 알게 됨 📖 나 tgyuu가 새롭게 알게된 부분 📖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant