Skip to content

Commit 3581c05

Browse files
committed
Refactor: 감정구슬 이미지 로딩 개선
- AsyncImage의 model 생성 시 remember를 사용하여 불필요한 재생성 방지
1 parent 5c17495 commit 3581c05

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/CollapsibleHomeHeader.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.statusBarsPadding
1414
import androidx.compose.material3.Text
1515
import androidx.compose.runtime.Composable
1616
import androidx.compose.runtime.getValue
17+
import androidx.compose.runtime.remember
1718
import androidx.compose.ui.Alignment
1819
import androidx.compose.ui.Modifier
1920
import androidx.compose.ui.draw.alpha
@@ -44,6 +45,7 @@ fun CollapsibleHomeHeader(
4445
onRegisterEmotion: () -> Unit,
4546
modifier: Modifier = Modifier,
4647
) {
48+
val context = LocalContext.current
4749
val alpha by animateFloatAsState(
4850
targetValue = 1f - collapsibleHeaderState.collapseProgress,
4951
animationSpec = tween(durationMillis = 300),
@@ -102,16 +104,16 @@ fun CollapsibleHomeHeader(
102104
}
103105

104106
AsyncImage(
105-
model = ImageRequest.Builder(LocalContext.current)
106-
.data(todayEmotion?.imageUrl)
107-
.crossfade(true)
108-
.size(Size.ORIGINAL)
109-
.build(),
107+
model = remember(todayEmotion?.imageUrl) {
108+
ImageRequest.Builder(context)
109+
.data(todayEmotion?.imageUrl)
110+
.crossfade(true)
111+
.build()
112+
},
110113
contentDescription = null,
111114
placeholder = painterResource(R.drawable.default_emotion),
112115
error = painterResource(R.drawable.default_emotion),
113116
contentScale = ContentScale.Fit,
114-
filterQuality = FilterQuality.High,
115117
modifier = Modifier
116118
.align(Alignment.BottomEnd)
117119
.padding(end = 18.dp)

0 commit comments

Comments
 (0)