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]. * @param style the style, default is [InteractionDefaults.rippleStyle].
* @return [Indication] * @return [Indication]
*/ */
@Suppress("DEPRECATION_ERROR")
@Composable @Composable
fun rememberRipple(style: RippleStyle = InteractionDefaults.rippleStyle()) = 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) materialRememberRipple(style.bounded, style.radius, style.color)
/** /**

View File

@@ -19,11 +19,8 @@
* *
* This file is created by fankes on 2024/1/12. * This file is created by fankes on 2024/1/12.
*/ */
@file:OptIn(ExperimentalFoundationApi::class)
package com.highcapable.flexiui.demo.screen package com.highcapable.flexiui.demo.screen
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@@ -150,7 +147,7 @@ fun LazyListScreen() {
HorizontalPager( HorizontalPager(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
state = pagerState, state = pagerState,
beyondBoundsPageCount = pageCount beyondViewportPageCount = pageCount
) { index -> ) { index ->
@Composable @Composable
fun LazyItem(modifier: Modifier, index: Int) { fun LazyItem(modifier: Modifier, index: Int) {
@@ -189,7 +186,7 @@ fun LazyListScreen() {
key = { testListData[it].index } key = { testListData[it].index }
) { index -> ) { index ->
LazyItem( LazyItem(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItem(),
index = index index = index
) )
} }
@@ -208,7 +205,7 @@ fun LazyListScreen() {
key = { testListData[it].index } key = { testListData[it].index }
) { index -> ) { index ->
LazyItem( LazyItem(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItem(),
index = index index = index
) )
} }

View File

@@ -19,12 +19,9 @@
* *
* This file is created by fankes on 2024/1/12. * This file is created by fankes on 2024/1/12.
*/ */
@file:OptIn(ExperimentalFoundationApi::class)
package com.highcapable.flexiui.demo.screen package com.highcapable.flexiui.demo.screen
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -159,7 +156,7 @@ fun MainScreen() {
HorizontalPager( HorizontalPager(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
state = pagerState, state = pagerState,
beyondBoundsPageCount = pageCount beyondViewportPageCount = pageCount
) { index -> ) { index ->
val modifier = Modifier.padding(innerPadding) val modifier = Modifier.padding(innerPadding)
when (index) { when (index) {