From f39ca208216307fcdffeb1afdc05280b6d18f7c0 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Sun, 10 Nov 2024 22:55:58 +0800 Subject: [PATCH] refactor: merge to compose new version usage --- .../flexiui/component/interaction/Interaction.kt | 3 +++ .../highcapable/flexiui/demo/screen/LazyListScreen.kt | 9 +++------ .../com/highcapable/flexiui/demo/screen/MainScreen.kt | 5 +---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/interaction/Interaction.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/interaction/Interaction.kt index a92b536..db86acc 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/interaction/Interaction.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/interaction/Interaction.kt @@ -60,8 +60,11 @@ data class RippleStyle( * @param style the style, default is [InteractionDefaults.rippleStyle]. * @return [Indication] */ +@Suppress("DEPRECATION_ERROR") @Composable fun rememberRipple(style: RippleStyle = InteractionDefaults.rippleStyle()) = + // FIXME: Compose deprecated the rememberRipple function, + // it's no effect without Android platform now, need to migrate to the new API. materialRememberRipple(style.bounded, style.radius, style.color) /** diff --git a/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/LazyListScreen.kt b/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/LazyListScreen.kt index 0bd8999..0114d67 100644 --- a/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/LazyListScreen.kt +++ b/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/LazyListScreen.kt @@ -19,11 +19,8 @@ * * This file is created by fankes on 2024/1/12. */ -@file:OptIn(ExperimentalFoundationApi::class) - package com.highcapable.flexiui.demo.screen -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize @@ -150,7 +147,7 @@ fun LazyListScreen() { HorizontalPager( modifier = Modifier.fillMaxSize(), state = pagerState, - beyondBoundsPageCount = pageCount + beyondViewportPageCount = pageCount ) { index -> @Composable fun LazyItem(modifier: Modifier, index: Int) { @@ -189,7 +186,7 @@ fun LazyListScreen() { key = { testListData[it].index } ) { index -> LazyItem( - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), index = index ) } @@ -208,7 +205,7 @@ fun LazyListScreen() { key = { testListData[it].index } ) { index -> LazyItem( - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), index = index ) } diff --git a/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/MainScreen.kt b/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/MainScreen.kt index 713039a..54cb42a 100644 --- a/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/MainScreen.kt +++ b/samples/composeApp/src/commonMain/kotlin/com/highcapable/flexiui/demo/screen/MainScreen.kt @@ -19,12 +19,9 @@ * * This file is created by fankes on 2024/1/12. */ -@file:OptIn(ExperimentalFoundationApi::class) - package com.highcapable.flexiui.demo.screen import androidx.compose.animation.AnimatedVisibility -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -159,7 +156,7 @@ fun MainScreen() { HorizontalPager( modifier = Modifier.fillMaxSize(), state = pagerState, - beyondBoundsPageCount = pageCount + beyondViewportPageCount = pageCount ) { index -> val modifier = Modifier.padding(innerPadding) when (index) {