UltraSwipeRefresh

fun UltraSwipeRefresh(state: UltraSwipeRefreshState, onRefresh: () -> Unit, onLoadMore: () -> Unit, modifier: Modifier = Modifier, headerScrollMode: NestedScrollMode = UltraSwipeRefreshTheme.config.headerScrollMode, footerScrollMode: NestedScrollMode = UltraSwipeRefreshTheme.config.footerScrollMode, refreshEnabled: Boolean = UltraSwipeRefreshTheme.config.refreshEnabled, loadMoreEnabled: Boolean = UltraSwipeRefreshTheme.config.loadMoreEnabled, @FloatRange(from = 0.0, fromInclusive = false) refreshTriggerRate: Float = UltraSwipeRefreshTheme.config.refreshTriggerRate, @FloatRange(from = 0.0, fromInclusive = false) loadMoreTriggerRate: Float = UltraSwipeRefreshTheme.config.loadMoreTriggerRate, @FloatRange(from = 1.0) headerMaxOffsetRate: Float = UltraSwipeRefreshTheme.config.headerMaxOffsetRate, @FloatRange(from = 1.0) footerMaxOffsetRate: Float = UltraSwipeRefreshTheme.config.footerMaxOffsetRate, @FloatRange(from = 0.0, to = 1.0, fromInclusive = false) dragMultiplier: Float = UltraSwipeRefreshTheme.config.dragMultiplier, @IntRange(from = 0, to = 2000) finishDelayMillis: Long = UltraSwipeRefreshTheme.config.finishDelayMillis, vibrateEnabled: Boolean = UltraSwipeRefreshTheme.config.vibrateEnabled, alwaysScrollable: Boolean = UltraSwipeRefreshTheme.config.alwaysScrollable, headerIndicator: @Composable (UltraSwipeRefreshState) -> Unit = UltraSwipeRefreshTheme.config.headerIndicator, footerIndicator: @Composable (UltraSwipeRefreshState) -> Unit = UltraSwipeRefreshTheme.config.footerIndicator, contentContainer: @Composable (@Composable () -> Unit) -> Unit = UltraSwipeRefreshTheme.config.contentContainer, content: @Composable () -> Unit)

UltraSwipeRefresh:一个可带来极致体验的Compose刷新组件;支持下拉刷新和上拉加载,可完美替代官方的SwipeRefresh;并且支持的功能更多,可扩展性更强。

Author

Jenly

Follow me

Parameters

state

状态:主要用于控制和观察UltraSwipeRefresh;比如:控制下拉刷新和上拉加载和观察其状态。

onRefresh

在完成滑动刷新手势时触发调用

onLoadMore

在完成滑动加载手势时触发调用

modifier

修饰符:用于装饰或添加Compose UI元素的行为。具体更详细的说明可查看Modifier

headerScrollMode

在进行滑动刷新时Header的滑动模式;具体更详细的样式说明可查看NestedScrollMode

footerScrollMode

在进行滑动加载更多时Footer的滑动模式;具体更详细的样式说明可查看NestedScrollMode

refreshEnabled

是否启用下拉刷新

loadMoreEnabled

是否启用上拉加载

refreshTriggerRate

触发滑动刷新的最小滑动比例;比例基于headerIndicator的高度;默认为:1

loadMoreTriggerRate

触发滑动加载更多最小滑动比例;比例基于footerIndicator的高度;默认为:1

headerMaxOffsetRate

向下滑动时headerIndicator可滑动的最大偏移比例;比例基于headerIndicator的高度;默认为:2

footerMaxOffsetRate

向上滑动时footerIndicator可滑动的最大偏移比例;比例基于footerIndicator的高度;默认为:2

dragMultiplier

触发下拉刷新或上拉加载时的阻力系数;值越小,阻力越大;默认为:0.5

finishDelayMillis

完成时延时时间;让完成时的中间状态UltraSwipeRefreshState.isFinishing停留一会儿,定格的展示提示内容;默认:500毫秒

vibrateEnabled

是否启用振动,如果启用则当滑动偏移量满足触发刷新或触发加载更多时,会有振动效果;默认为:false

alwaysScrollable

是否始终可以滚动;当为true时,则会忽略刷新中或加载中的状态限制,始终可以进行滚动;默认为:false

headerIndicator

下拉刷新时顶部显示的Header指示器

footerIndicator

上拉加载更多时底部显示的Footer指示器

contentContainer

content的父容器,便于统一管理

content

可进行刷新或加载更多所包含的内容


fun UltraSwipeRefresh(isRefreshing: Boolean, isLoading: Boolean, onRefresh: () -> Unit, onLoadMore: () -> Unit, modifier: Modifier = Modifier, headerScrollMode: NestedScrollMode = UltraSwipeRefreshTheme.config.headerScrollMode, footerScrollMode: NestedScrollMode = UltraSwipeRefreshTheme.config.footerScrollMode, refreshEnabled: Boolean = UltraSwipeRefreshTheme.config.refreshEnabled, loadMoreEnabled: Boolean = UltraSwipeRefreshTheme.config.loadMoreEnabled, @FloatRange(from = 0.0, fromInclusive = false) refreshTriggerRate: Float = UltraSwipeRefreshTheme.config.refreshTriggerRate, @FloatRange(from = 0.0, fromInclusive = false) loadMoreTriggerRate: Float = UltraSwipeRefreshTheme.config.loadMoreTriggerRate, @FloatRange(from = 1.0) headerMaxOffsetRate: Float = UltraSwipeRefreshTheme.config.headerMaxOffsetRate, @FloatRange(from = 1.0) footerMaxOffsetRate: Float = UltraSwipeRefreshTheme.config.footerMaxOffsetRate, @FloatRange(from = 0.0, to = 1.0, fromInclusive = false) dragMultiplier: Float = UltraSwipeRefreshTheme.config.dragMultiplier, @IntRange(from = 0, to = 2000) finishDelayMillis: Long = UltraSwipeRefreshTheme.config.finishDelayMillis, vibrateEnabled: Boolean = UltraSwipeRefreshTheme.config.vibrateEnabled, alwaysScrollable: Boolean = UltraSwipeRefreshTheme.config.alwaysScrollable, headerIndicator: @Composable (UltraSwipeRefreshState) -> Unit = UltraSwipeRefreshTheme.config.headerIndicator, footerIndicator: @Composable (UltraSwipeRefreshState) -> Unit = UltraSwipeRefreshTheme.config.footerIndicator, contentContainer: @Composable (@Composable () -> Unit) -> Unit = UltraSwipeRefreshTheme.config.contentContainer, content: @Composable () -> Unit)

UltraSwipeRefresh:一个可带来极致体验的Compose刷新组件;支持下拉刷新和上拉加载,可完美替代官方的SwipeRefresh;并且支持的功能更多,可扩展性更强。

Parameters

isRefreshing

是否正在刷新

isLoading

是否正在加载

onRefresh

在完成滑动刷新手势时触发调用

onLoadMore

在完成滑动加载手势时触发调用

modifier

修饰符:用于装饰或添加Compose UI元素的行为。具体更详细的说明可查看Modifier

headerScrollMode

在进行滑动刷新时Header的滑动模式;具体更详细的样式说明可查看NestedScrollMode

footerScrollMode

在进行滑动加载更多时Footer的滑动模式;具体更详细的样式说明可查看NestedScrollMode

refreshEnabled

是否启用下拉刷新

loadMoreEnabled

是否启用上拉加载

refreshTriggerRate

触发滑动刷新的最小滑动比例;比例基于headerIndicator的高度;默认为:1

loadMoreTriggerRate

触发滑动加载更多最小滑动比例;比例基于footerIndicator的高度;默认为:1

headerMaxOffsetRate

向下滑动时headerIndicator可滑动的最大偏移比例;比例基于headerIndicator的高度;默认为:2

footerMaxOffsetRate

向上滑动时footerIndicator可滑动的最大偏移比例;比例基于footerIndicator的高度;默认为:2

dragMultiplier

触发下拉刷新或上拉加载时的阻力系数;值越小,阻力越大;默认为:0.5

finishDelayMillis

完成时延时时间;让完成时的中间状态UltraSwipeRefreshState.isFinishing停留一会儿,定格的展示提示内容;默认:500毫秒

vibrateEnabled

是否启用振动,如果启用则当滑动偏移量满足触发刷新或触发加载更多时,会有振动效果;默认为:false

alwaysScrollable

是否始终可以滚动;当为true时,则会忽略刷新中或加载中的状态限制,始终可以进行滚动;默认为:false

headerIndicator

下拉刷新时顶部显示的Header指示器

footerIndicator

上拉加载更多时底部显示的Footer指示器

contentContainer

content的父容器,便于统一管理

content

可进行刷新或加载更多所包含的内容