Skip to content

Commit

Permalink
[FEATURE] #125 : 공지사항 일정 클릭하면 확장 / 접히도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 17, 2024
1 parent a2854fc commit e4699a0
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
Expand All @@ -24,6 +25,11 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.SheetState
import androidx.compose.material3.SheetValue
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand Down Expand Up @@ -132,7 +138,17 @@ private fun EventItem(
bottomSheetState: SheetState,
event: Event,
) {
Column(modifier = Modifier.animateContentSize()) {
var eventItemToggle by remember { mutableStateOf(false) }

LaunchedEffect(bottomSheetState.currentValue) {
eventItemToggle = bottomSheetState.currentValue == SheetValue.Expanded
}

Column(
modifier = Modifier
.animateContentSize()
.clickable { eventItemToggle = !eventItemToggle },
) {
Row(
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically,
Expand Down Expand Up @@ -164,7 +180,7 @@ private fun EventItem(
color = WappTheme.colors.white,
)

AnimatedVisibility(bottomSheetState.currentValue == SheetValue.Expanded) {
AnimatedVisibility(eventItemToggle) {
Column(horizontalAlignment = Alignment.Start) {
Text(
text = event.location,
Expand Down

0 comments on commit e4699a0

Please sign in to comment.