Skip to content

Commit

Permalink
feat: pull to refresh 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 committed Oct 10, 2024
1 parent 3ac3a30 commit 1ca6354
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
package com.goalpanzi.mission_mate.feature.board.component

import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -51,7 +56,7 @@ import com.goalpanzi.mission_mate.feature.board.model.MissionState
import com.goalpanzi.mission_mate.feature.board.model.toEventType
import com.goalpanzi.mission_mate.feature.board.util.BoardManager
import com.goalpanzi.mission_mate.feature.board.util.BoardManager.getPositionScrollToMyIndex

import kotlin.math.min

@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterialApi::class)
@Composable
Expand Down Expand Up @@ -90,6 +95,9 @@ fun Board(
}?.number ?: 0
}
}
val refreshingSpacerSize by animateDpAsState(
targetValue = (min(pullRefreshState.progress, 1f) * 140).dp
)

LaunchedEffect(myIndex) {
scrollState.animateScrollTo(
Expand Down Expand Up @@ -155,6 +163,7 @@ fun Board(

)
) {
Spacer(modifier = Modifier.height(refreshingSpacerSize))
BoardContent(
missionBoards,
missionDetail,
Expand All @@ -181,6 +190,7 @@ fun Board(
.blur(10.dp, 10.dp)
)
) {
Spacer(modifier = Modifier.height(refreshingSpacerSize))
BoardContent(
missionBoards,
missionDetail,
Expand Down

0 comments on commit 1ca6354

Please sign in to comment.