Skip to content

Instantly share code, notes, and snippets.

View flaringapp's full-sized avatar

Andrew flaringapp

View GitHub Profile
@flaringapp
flaringapp / LazyListPagination
Created March 17, 2024 13:04
Implements mechanism for LazyList pagination callback. Also supports disabling (e.g. while loading) and throttling callbacks.
private const val DEFAULT_THROTTLE_TIMEOUT = 500L
@Composable
fun LazyListPagination(
state: LazyListState,
enable: Boolean,
onPaginate: () -> Unit,
offset: Int = 0,
throttleTimeout: Long = DEFAULT_THROTTLE_TIMEOUT,
) {
@flaringapp
flaringapp / FadingEdgesModifier.kt
Created June 21, 2023 13:10
Compose Fading Edge Modifier
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier