Skip to content

Commit

Permalink
[FEAT/#14] bottom sheet 사라지는 애니메이션 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 11, 2024
1 parent 4ab493f commit 0c69b82
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
Expand All @@ -24,6 +26,7 @@ import com.terning.core.R
import com.terning.core.designsystem.component.button.RoundButton
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand All @@ -32,6 +35,9 @@ fun SignUpBottomSheet(
onDismiss: () -> Unit,
onSaveClick: () -> Unit
) {
val scope = rememberCoroutineScope()
val sheetState = rememberModalBottomSheetState()

TerningBasicBottomSheet(
content = {
Column {
Expand All @@ -51,13 +57,21 @@ fun SignUpBottomSheet(
paddingVertical = 19.dp,
cornerRadius = 10.dp,
text = R.string.sign_up_dialog_start,
onButtonClick = { onSaveClick() },
onButtonClick = {
scope.launch { sheetState.hide() }
.invokeOnCompletion {
if (!sheetState.isVisible) {
onSaveClick()
}
}
},
modifier = modifier.padding(horizontal = 24.dp)
)
Spacer(modifier = modifier.padding(bottom = 15.dp))
}
},
onDismissRequest = { onDismiss() }
onDismissRequest = { onDismiss() },
sheetState = sheetState
)
}

Expand Down

0 comments on commit 0c69b82

Please sign in to comment.