mirror of
https://github.com/fankes/pagecurl-multiplatform.git
synced 2025-09-05 10:15:30 +08:00
Increase compose to 2023.03.00
This commit is contained in:
@@ -4,7 +4,7 @@ buildscript {
|
||||
min_sdk_version = 24
|
||||
target_sdk_version = 33
|
||||
|
||||
compose_bom_version = "2023.01.00"
|
||||
compose_bom_version = "2023.03.00"
|
||||
compose_compiler_version = "1.4.2"
|
||||
accompanist_version = "0.28.0"
|
||||
activity_version = "1.6.1"
|
||||
|
@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.key
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
@@ -69,19 +70,22 @@ public fun PageCurl(
|
||||
onTapBackward = state::prev,
|
||||
)
|
||||
) {
|
||||
if (updatedCurrent + 1 < state.max) {
|
||||
content(updatedCurrent + 1)
|
||||
}
|
||||
|
||||
if (updatedCurrent < state.max) {
|
||||
Box(Modifier.drawCurl(config, internalState.forward.value.top, internalState.forward.value.bottom)) {
|
||||
content(updatedCurrent)
|
||||
// Wrap in key to synchronize state updates
|
||||
key(updatedCurrent, internalState.forward.value, internalState.backward.value) {
|
||||
if (updatedCurrent + 1 < state.max) {
|
||||
content(updatedCurrent + 1)
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedCurrent > 0) {
|
||||
Box(Modifier.drawCurl(config, internalState.backward.value.top, internalState.backward.value.bottom)) {
|
||||
content(updatedCurrent - 1)
|
||||
if (updatedCurrent < state.max) {
|
||||
Box(Modifier.drawCurl(config, internalState.forward.value.top, internalState.forward.value.bottom)) {
|
||||
content(updatedCurrent)
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedCurrent > 0) {
|
||||
Box(Modifier.drawCurl(config, internalState.backward.value.top, internalState.backward.value.bottom)) {
|
||||
content(updatedCurrent - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user