Skip to content

Commit

Permalink
[Mod/#26] 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoeunjoo committed Jan 20, 2025
1 parent 9304eb4 commit 008f444
Showing 1 changed file with 75 additions and 75 deletions.
150 changes: 75 additions & 75 deletions app/src/main/java/org/memento/presentation/today/TodayScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ fun TodayScreen(modifier: Modifier = Modifier) {

Column(
modifier =
Modifier
.fillMaxSize()
.background(color = darkModeColors.black),
Modifier
.fillMaxSize()
.background(color = darkModeColors.black),
) {
val allDay =
listOf(
Expand All @@ -76,9 +76,9 @@ fun TodayScreen(modifier: Modifier = Modifier) {

Box(
modifier =
Modifier
.fillMaxWidth()
.heightIn(max = (5 * 30).dp),
Modifier
.fillMaxWidth()
.heightIn(max = (5 * 30).dp),
) {
val state = rememberLazyListState()
LazyColumn(
Expand All @@ -96,8 +96,8 @@ fun TodayScreen(modifier: Modifier = Modifier) {
if (dummyDataState.isEmpty()) {
Box(
modifier =
Modifier
.fillMaxSize(),
Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Text(
Expand All @@ -110,12 +110,12 @@ fun TodayScreen(modifier: Modifier = Modifier) {
Box {
LazyColumn(
modifier =
Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.onGloballyPositioned { it ->
listHeight = it.size.height
},
Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.onGloballyPositioned { it ->
listHeight = it.size.height
},
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
item {
Expand All @@ -124,11 +124,11 @@ fun TodayScreen(modifier: Modifier = Modifier) {
style = MementoTheme.typography.body_b_16,
color = darkModeColors.gray05,
modifier =
Modifier
.padding(top = 16.dp)
.onGloballyPositioned { it ->
itemHeight = it.size.height
},
Modifier
.padding(top = 16.dp)
.onGloballyPositioned { it ->
itemHeight = it.size.height
},
)
}

Expand All @@ -143,44 +143,44 @@ fun TodayScreen(modifier: Modifier = Modifier) {

Box(
modifier =
Modifier
.fillMaxWidth()
.graphicsLayer(
scaleX = scale.value,
scaleY = scale.value,
translationY = if (isDragging) draggedOffsetY else 0f,
)
.pointerInput(Unit) {
detectDragGestures(
onDragStart = {
draggedItemIndex = index
initialIndex = index
},
onDrag = { change, dragAmount ->
change.consume()
draggedOffsetY += dragAmount.y
val targetIndex =
(draggedItemIndex + (draggedOffsetY / 60.dp.toPx()).toInt())
.coerceIn(0, dummyDataState.size - 1)
if (targetIndex != draggedItemIndex) {
dummyDataState.move(draggedItemIndex, targetIndex)
draggedItemIndex = targetIndex
draggedOffsetY = 0f
}
},
onDragEnd = {
finalIndex = draggedItemIndex
draggedItemIndex = -1
draggedOffsetY = 0f
isDraggingEnabled = false
draggedStarted = false
},
onDragCancel = {
isDraggingEnabled = false
draggedStarted = false
},
Modifier
.fillMaxWidth()
.graphicsLayer(
scaleX = scale.value,
scaleY = scale.value,
translationY = if (isDragging) draggedOffsetY else 0f,
)
},
.pointerInput(Unit) {
detectDragGestures(
onDragStart = {
draggedItemIndex = index
initialIndex = index
},
onDrag = { change, dragAmount ->
change.consume()
draggedOffsetY += dragAmount.y
val targetIndex =
(draggedItemIndex + (draggedOffsetY / 60.dp.toPx()).toInt())
.coerceIn(0, dummyDataState.size - 1)
if (targetIndex != draggedItemIndex) {
dummyDataState.move(draggedItemIndex, targetIndex)
draggedItemIndex = targetIndex
draggedOffsetY = 0f
}
},
onDragEnd = {
finalIndex = draggedItemIndex
draggedItemIndex = -1
draggedOffsetY = 0f
isDraggingEnabled = false
draggedStarted = false
},
onDragCancel = {
isDraggingEnabled = false
draggedStarted = false
},
)
},
) {
when (item) {
is MementoItem.TodoItem -> {
Expand Down Expand Up @@ -212,31 +212,31 @@ fun TodayScreen(modifier: Modifier = Modifier) {
style = MementoTheme.typography.body_b_16,
color = darkModeColors.gray05,
modifier =
Modifier
.padding(bottom = 16.dp),
Modifier
.padding(bottom = 16.dp),
)
}
}
Column(
modifier =
Modifier
.offset(x = 28.dp)
.width(1.dp)
.height(with(density) { listHeight.toDp() })
.padding(vertical = with(density) { itemHeight.toDp() + 16.dp })
.background(
brush =
Brush.linearGradient(
colors =
listOf(
Color.Transparent,
mementoColors.progressBar,
mementoColors.progressBar,
mementoColors.progressBar,
Color.Transparent,
),
Modifier
.offset(x = 28.dp)
.width(1.dp)
.height(with(density) { listHeight.toDp() })
.padding(vertical = with(density) { itemHeight.toDp() + 16.dp })
.background(
brush =
Brush.linearGradient(
colors =
listOf(
Color.Transparent,
mementoColors.progressBar,
mementoColors.progressBar,
mementoColors.progressBar,
Color.Transparent,
),
),
),
),
) {
}
}
Expand Down

0 comments on commit 008f444

Please sign in to comment.