Skip to content

Instantly share code, notes, and snippets.

View TheMelody's full-sized avatar
🤪

被风吹过的夏天 TheMelody

🤪
View GitHub Profile
companion object {
/** The magnitude of rotation while the list is scrolled. */
private const val SCROLL_ROTATION_MAGNITUDE = 0.25f
/** The magnitude of rotation while the list is over-scrolled. */
private const val OVERSCROLL_ROTATION_MAGNITUDE = -10
/** The magnitude of translation distance while the list is over-scrolled. */
private const val OVERSCROLL_TRANSLATION_MAGNITUDE = 0.2f
@vganin
vganin / ComposeNumberPicker.kt
Last active January 14, 2024 11:53
Jetpack Compose simple number picker
@Composable
fun NumberPicker(
state: MutableState<Int>,
modifier: Modifier = Modifier,
range: IntRange? = null,
textStyle: TextStyle = LocalTextStyle.current,
onStateChanged: (Int) -> Unit = {},
) {
val coroutineScope = rememberCoroutineScope()
val numbersColumnHeight = 36.dp
@DavidIbrahim
DavidIbrahim / DashedBorder.kt
Last active August 28, 2024 11:52
dashedBorder modifier for android compose
import androidx.compose.foundation.BorderStroke
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@iamutkarshtiwari
iamutkarshtiwari / Jetpack Compose Right and Left ModalDrawer
Last active July 29, 2023 10:12
Custom Jetpack Compose ModalDrawer to support Left and Right alignments
package com.iamutkarshtiwari.ds.component.drawer
import androidx.annotation.FloatRange
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
@TheMelody
TheMelody / Compose - MultiFloatingActionButton.kt
Last active November 20, 2021 06:43
Jetpack Compose - FloatingActionButton 展开/折叠 的多级悬浮菜单
/**
* 折叠/展开多个FloatingActionButton菜单
*/
@Composable
fun MultiFloatingActionButton(
modifier: Modifier = Modifier,
srcIcon: ImageVector,
srcIconColor: Color = Color.White,
fabBackgroundColor: Color = Color.Unspecified,
showLabels: Boolean = true,
@c5inco
c5inco / HeartRate.kt
Last active July 31, 2024 09:42
Jetpack Compose implementation of inspiration: https://twitter.com/amos_gyamfi/status/1494053914945236999
package des.c5inco.material3
import android.graphics.Matrix
import android.graphics.Path
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
@StylianosGakis
StylianosGakis / Bouncy ropes demo
Last active July 19, 2023 08:55
Jetpack Compose demo for an animated bouncy rope draggable with your mouse
import androidx.compose.animation.core.animateOffsetAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@fabriciovergara
fabriciovergara / CollapsibleTopAppBar.kt
Last active September 16, 2024 19:56
Collapsible TopAppBar in Jetpack Compose
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row