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

팝업 여러 개 띄울 수 있게 변경 #315

Merged
merged 4 commits into from
Jul 18, 2024
Merged

Conversation

plgafhd
Copy link
Collaborator

@plgafhd plgafhd commented Jul 10, 2024

No description provided.

@plgafhd plgafhd requested a review from a team as a code owner July 10, 2024 16:10
@plgafhd
Copy link
Collaborator Author

plgafhd commented Jul 10, 2024

https://wafflestudio.slack.com/archives/C0PAVPS5T/p1720195095417099
팝업 여러 개 띄울 수 있게 변경
다만 사진이 작으면 보기가 다소 좋지 않다 (크면 넘칠수도 있을까...?) -> 85af9cf
폴드 같은 경우 너무 크게 나올 수 있다 -> 959f9e0

Comment on lines 5 to 7
class PopupState {
var popup: GetPopupResults.Popup? = null
var popup: List<GetPopupResults.Popup> = listOf()
var fetched: Boolean = false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

핵심 아이디어는 PopupState에 List가 들어감으로써,
보여줄 팝업 목록을 filter로 뽑고, (기존에는 firstOrNull로 있었던 부분)
그 중 첫번째거를 보여준다.
닫기를 하면 첫번째거를 삭제한다.

Comment on lines 38 to 43
AsyncImage(
modifier = Modifier.fillMaxWidth(),
model = uri,
contentDescription = "",
error = painterResource(id = R.drawable.img_reviews_coming_soon),
contentScale = ContentScale.FillWidth,
)
Copy link
Collaborator Author

@plgafhd plgafhd Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. modifier = Modifier.fillMaxWidth()
  2. contentScale = ContentScale.FillWidth

두 개의 역할은 비슷해보인다. 심지어 공식문서에도 2로 나와있는데 작동을 안하고 있다.

1만 넣음 -> 작동 O
1, 2 둘다 넣음 -> 작동 O
2만 넣음 -> 작동 X

Copy link
Collaborator Author

@plgafhd plgafhd Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이유 정리 (사실 공식 문서를 토대로 한 추론에 가깝다)
contentScale = ContentScale.FillWidth에서 width는
parent의 width가 아니고, 자신의 modifier가 갖는 width이다.

따라서

  1. AsyncImage의 width를 지정 안하면 -> 갖고온 이미지를 토대로 width가 지정되는데, 그러면 사진이 이미 Fillwidth를 만족하므로 더 할게 없다.
  2. AsyncImage의 width를 지정하면 -> 그 지정된 width를 토대로 이미지에 대해 Fillwidth를 한다.
  3. 그런데 2.에서 Fillwidth를 안해도, ContentScale.Fit이 기본값으로 들어가서 가로/세로 중 꽉 채울수 있는 방향으로 꽉 채운다.

그 동안은 1.에 따라 그냥 이미지의 크기 그대로 보여주고 있었다.

Copy link
Collaborator

@JuTaK97 JuTaK97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

실행해보니 잘 돌아가네~ 즉시어푸룹~

@plgafhd plgafhd merged commit 4e75675 into develop Jul 18, 2024
3 checks passed
@plgafhd plgafhd deleted the plgafhd/fix-popups branch July 18, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants