Skip to content

commandiron/BigDecimalVisualTransformationCompose

Repository files navigation

BigDecimalVisualTransformationCompose

Usage

val bigDecimal = 123456879.12.toBigDecimal()

TextField(
    value = bigDecimal.toString(),
    onValueChange = {},
    visualTransformation = BigDecimalVisualTransformationWithUnit(
        unit = "β",
    )
)

//Also you can use with Text components.

Text(
    text = BigDecimalVisualTransformationWithUnit().getTransformedText(
        text = bigDecimal.toString(),
        addedUnit = "β"
    ),
)

How it looks

Setup

  1. Open the file settings.gradle (it looks like that)
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // add jitpack here 👇🏽
        maven { url 'https://jitpack.io' }
       ...
    }
} 
...
  1. Sync the project
  2. Add dependency
dependencies {
        implementation 'com.github.commandiron:BigDecimalVisualTransformationCompose:1.0.0'
}