Skip to content

Instantly share code, notes, and snippets.

View TheMelody's full-sized avatar
🤪

被风吹过的夏天 TheMelody

🤪
View GitHub Profile
@TheMelody
TheMelody / ComposeColorShadow.kt
Created February 3, 2023 06:07
Compose阴影扩展 - 适用于规则的可组合项
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@TheMelody
TheMelody / Compose - MultiBottomSheetLayout.kt
Last active June 5, 2021 05:18
Compose BottomSheet控件封装 - MultiBottomSheetLayout.kt
/**
* 组合式BottomSheetDialog
* @param sheetModifier 仅影响BottomSheet布局,不影响mainContent布局
* @param sheetElevation bottomSheet背景的阴影
* @param sheetShape bottomSheet的视图shape
* @param mainContent activity的contentView
* @param sheetContent bottomSheet弹出来的contentView
* @param topLeftIcon 内置的顶部左侧Icon
* @param topCenterIcon 内置的顶部中心点的Icon
* @param topRightIcon 内置的顶部右侧Icon
@TheMelody
TheMelody / Compose - CustomWebView.kt
Last active March 28, 2024 06:43
Jetpack Compose - WebView 使用方法
@Composable
fun CustomWebView(modifier: Modifier = Modifier,
url:String,
onBack: (webView:WebView?) -> Unit,
onProgressChange: (progress:Int)->Unit = {},
initSettings: (webSettings:WebSettings?) -> Unit = {},
onReceivedError: (error: WebResourceError?) -> Unit = {}){
val webViewChromeClient = object:WebChromeClient(){
override fun onProgressChanged(view: WebView?, newProgress: Int) {
//回调网页内容加载进度
@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,