Skip to content

idapgroup/BlurOverflowText

Repository files navigation

BlurOverflowText Android Compose

Blur overflow text effect for compose enjoyers.

image image

Setup

Please, add to repositories jitpack:

repositories {
  mavenCentral()
  ...
  maven { url 'https://jitpack.io' }
}

Add to your module next dependency:

dependencies {
  implementation 'com.github.idapgroup:BlurOverflowText:<latest-version>'
}

Note: Do not forget to add compose dependencies 🙃

Usage sample

BlurOverflowText has all the base Text parameters except of overflow and softWrap to avoid unexpected library behavior.

The library works only if maxLines parameter is set.

If text exeeds the boundary limit, the last line of the text will be blured. blurLineWidth have all responsibilities for this.

Just provide expected blur length (default value is 0.2f which means 20% on the line width).

        BlurOverflowText(
            text = "Some very long string that should overflow this line.",
            modifier = Modifier.align(Alignment.Center),
            maxLines = 1,
            fontSize = 24.sp,
            blurLineWidth = 0.2f,
        )