Site icon Android Tutorial Online

An OTP library for JetPack Compose

Otp Widget For JetpackCompose

An Otp Widget to enter passwords, sms codes , …


Dependency

Step 1: Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2: Add the dependency

dependencies {
  implementation 'com.github.ehsannarmani:OtpCompose:latest_version'
}

Usage

Otp(
    count = 5,
    error = false,
    success = true,
    errorColor = Color(0xffffffff),
    successColor = Color(0xffffffff),
    focusedColor = Color(0xff313131),
    unFocusedColor = Color.Gray,
    onFinish = { otp->
       // do something
    },
    modifier=Modifier.size(60.dp,90.dp),
    ...
)  

Todos

  1. Add new features
  2. Add paste feature

GitHub

View Github

Exit mobile version