Site icon Android Tutorial Online

ComposeShadowsPlus: Elevate your Android Compose UI with stunning custom shadows

ComposeShadowsPlus

ComposeShadowsPlus is a powerful Android Compose library that empowers developers with the ability to easily create and customize stunning, high-quality shadows for their UI elements.

Features:

Sample App

RSBlurSoftLayerElevation

Download or clone this repository to discover the sample app.

Setup

Add to the root build.gradle.kts:allprojects { repositories { … maven(“https://jitpack.io”) } }

Add to the package build.gradle.kts:dependencies { implementation(“com.github.GIGAMOLE:ComposeShadowsPlus:{latest-version}”) }

Latest version is: .

Also, it’s possible to download the latest artifact from the releases page.

Guide

ComposeShadowsPlus provides two custom shadow ModifiersRSBlurShadow and SoftLayerShadow

ComposeShadowsPlus common params:

ParamDescription
radiusThe shadow radius.
colorThe shadow color.
shapeThe shadow shape.
spreadThe shadow positive or negative spread.
offsetThe shadow offset.

ShadowsPlusDefaults contains default values of custom shadows.

You can use Modifier.shadowsPlus(...) to set the custom shadows with ShadowsPlusType enum.

RSBlurShadow

RSBlurShadow uses RenderScript and ScriptIntrinsicBlur to blur the shadow content to simulate the shadow.

RSBlurShadow more params:

ParamDescription
alignRadiusThe exponential align radius indicator.

To apply RSBlurShadow use Modifier.rsBlurShadow(...).

SoftLayerShadow

SoftLayerShadow uses NativePaint.setShadowLayer(...) to apply native shadow layer to the shadow content.

To render SoftLayerShadow, Android devices with API < 28(P), need to use View.LAYER_TYPE_SOFTWARE. It’s recommended to use SoftLayerShadowContainer to handle this automatically.

To apply SoftLayerShadow use Modifier.softLayerShadow(...).

License

MIT License. See the LICENSE file for more details.

Credits

Special thanks to the GoDaddy for the amazing color picker library.

Created at intiveWe spark digital excitement.

Author:

Basil Miller gigamole53@gmail.com

GitHub

View Github

Exit mobile version