mirror of
https://github.com/fankes/pagecurl-multiplatform.git
synced 2025-09-06 10:45:43 +08:00
Increase compose to 2023.03.00
This commit is contained in:
@@ -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