refactor: merge to compose new version usage

This commit is contained in:
2024-11-10 22:55:58 +08:00
parent 5efe1d636f
commit f39ca20821
3 changed files with 7 additions and 10 deletions

View File

@@ -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)
/**

View File

@@ -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
)
}

View File

@@ -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) {