mirror of
https://github.com/fankes/pagecurl-multiplatform.git
synced 2025-09-07 03:05:59 +08:00
Update versions, add detekt and spotless
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@file:OptIn(ExperimentalPageCurlApi::class)
|
||||
@file:Suppress("MagicNumber")
|
||||
|
||||
package eu.wewox.pagecurl.screens
|
||||
|
||||
@@ -42,6 +43,10 @@ import eu.wewox.pagecurl.ui.SpacingLarge
|
||||
import eu.wewox.pagecurl.ui.SpacingMedium
|
||||
import eu.wewox.pagecurl.ui.SpacingSmall
|
||||
|
||||
/**
|
||||
* Back-Page Configuration in Page Curl.
|
||||
* Example how to customize the back-page (the back of the page user see during the drag or animation).
|
||||
*/
|
||||
@Composable
|
||||
fun BackPagePageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
@@ -86,7 +91,7 @@ private fun SettingsRow(
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = SpacingMedium)
|
||||
.padding(vertical = SpacingLarge)
|
||||
) {
|
||||
Text(
|
||||
text = "Alpha",
|
||||
|
@@ -38,6 +38,10 @@ import eu.wewox.pagecurl.ui.SpacingLarge
|
||||
import eu.wewox.pagecurl.ui.SpacingMedium
|
||||
import eu.wewox.pagecurl.ui.SpacingSmall
|
||||
|
||||
/**
|
||||
* Interactions Configurations In Page Curl.
|
||||
* Example interactions (drag / tap) can be customized.
|
||||
*/
|
||||
@Composable
|
||||
fun InteractionConfigInPageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
@@ -114,37 +118,48 @@ private fun SettingsRow(
|
||||
}
|
||||
}
|
||||
|
||||
when (selectedOption) {
|
||||
InteractionOption.Drag -> {
|
||||
Slider(
|
||||
value = config.dragForwardInteraction.start.left,
|
||||
onValueChange = {
|
||||
config.dragForwardInteraction = PageCurlConfig.DragInteraction(
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
Rect(0.0f, 0.0f, it, 1.0f)
|
||||
)
|
||||
config.dragBackwardInteraction = PageCurlConfig.DragInteraction(
|
||||
Rect(0.0f, 0.0f, it, 1.0f),
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
InteractionOption.Tap -> {
|
||||
Slider(
|
||||
value = config.tapForwardInteraction.target.left,
|
||||
onValueChange = {
|
||||
config.tapForwardInteraction = PageCurlConfig.TapInteraction(
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
)
|
||||
config.tapBackwardInteraction = PageCurlConfig.TapInteraction(
|
||||
Rect(0.0f, 0.0f, it, 1.0f),
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
SettingsRowSlider(
|
||||
selectedOption = selectedOption,
|
||||
config = config,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SettingsRowSlider(
|
||||
selectedOption: InteractionOption,
|
||||
config: PageCurlConfig,
|
||||
) {
|
||||
when (selectedOption) {
|
||||
InteractionOption.Drag -> {
|
||||
Slider(
|
||||
value = config.dragForwardInteraction.start.left,
|
||||
onValueChange = {
|
||||
config.dragForwardInteraction = PageCurlConfig.DragInteraction(
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
Rect(0.0f, 0.0f, it, 1.0f)
|
||||
)
|
||||
config.dragBackwardInteraction = PageCurlConfig.DragInteraction(
|
||||
Rect(0.0f, 0.0f, it, 1.0f),
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
InteractionOption.Tap -> {
|
||||
Slider(
|
||||
value = config.tapForwardInteraction.target.left,
|
||||
onValueChange = {
|
||||
config.tapForwardInteraction = PageCurlConfig.TapInteraction(
|
||||
Rect(it, 0.0f, 1.0f, 1.0f),
|
||||
)
|
||||
config.tapBackwardInteraction = PageCurlConfig.TapInteraction(
|
||||
Rect(0.0f, 0.0f, it, 1.0f),
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,10 @@ import eu.wewox.pagecurl.config.rememberPageCurlConfig
|
||||
import eu.wewox.pagecurl.page.PageCurl
|
||||
import eu.wewox.pagecurl.page.rememberPageCurlState
|
||||
|
||||
/**
|
||||
* Page Curl With Settings.
|
||||
* Showcases how individual interactions can be toggled on / off.
|
||||
*/
|
||||
@Composable
|
||||
fun SettingsPageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
@file:OptIn(ExperimentalPageCurlApi::class)
|
||||
@file:Suppress("MagicNumber")
|
||||
|
||||
package eu.wewox.pagecurl.screens
|
||||
|
||||
@@ -29,6 +30,10 @@ import eu.wewox.pagecurl.page.PageCurl
|
||||
import eu.wewox.pagecurl.page.rememberPageCurlState
|
||||
import eu.wewox.pagecurl.ui.SpacingLarge
|
||||
|
||||
/**
|
||||
* Shadow Configuration in Page Curl.
|
||||
* Example how to customize shadow of the page.
|
||||
*/
|
||||
@Composable
|
||||
fun ShadowInPageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
|
@@ -13,6 +13,10 @@ import eu.wewox.pagecurl.components.HowToPage
|
||||
import eu.wewox.pagecurl.page.PageCurl
|
||||
import eu.wewox.pagecurl.page.rememberPageCurlState
|
||||
|
||||
/**
|
||||
* Page Curl With Settings.
|
||||
* Showcases how individual interactions can be toggled on / off.
|
||||
*/
|
||||
@Composable
|
||||
fun SimplePageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
|
@@ -35,6 +35,10 @@ import eu.wewox.pagecurl.ui.SpacingLarge
|
||||
import eu.wewox.pagecurl.ui.SpacingMedium
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* Page Curl With State Management.
|
||||
* Example how state can be used to change current page (snap / animate).
|
||||
*/
|
||||
@Composable
|
||||
fun StateInPageCurlScreen() {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
|
Reference in New Issue
Block a user