패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.3

otp_screen

간단한 코드로 OTP 화면을 만들 수 있도록 도와주는 새로운 Flutter 패키지입니다.

30일 다운로드
18
좋아요
28
Pub 점수
30

패키지 설치

flutter pub add otp_screen

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

otp_screen 패키지는 최소한의 코드로 OTP 입력 화면을 쉽게 만들 수 있도록 도와주는 Flutter 유틸리티입니다. 숫자 및 텍스트 입력을 모두 지원하는 깔끔하고 사용자 정의 가능한 위젯을 제공합니다. 포커스 관리를 자동으로 처리하고 필드 간 부드러운 전환을 제공하며 인증 흐름에 원활하게 통합됩니다. 개발자가 OTP 입력을 빠르고 신뢰성 있게 구현할 수 있도록 설계되었으며, 반복 코드를 줄이고 사용자 경험을 향상시킵니다.

사용 사례

  • OTP를 사용한 사용자 인증
  • 계정 검증 워크플로우
  • 이중 인증
  • 일회용 코드로 로그인
  • 시간 제한 토큰을 위한 안전한 폼 입력

주요 기능

  • 코드 몇 줄로 최소한의 설정
  • 필드 간 자동 포커스 처리
  • 사용자 정의 가능한 입력 디자인
  • 숫자 및 텍스트 입력을 모두 지원합니다
  • 내장된 검증 및 오류 처리

적합한 대상

  • 로그인 또는 인증 화면을 구축하는 개발자
  • 보안 OTP 입력이 필요한 프로젝트
  • 2단계 인증 또는 SMS 기반 인증을 사용하는 앱
  • 인증 UI의 빠른 프로토타이핑
  • 시간 제한이 있는 코드 입력을 가진 모바일 앱

고려 사항

  • OTP 전용 사용 사례에 한정
  • 동적 필드 수에 대한 내장 지원 없음
  • 백엔드 검증과 수동 통합이 필요합니다
  • OTP 재전송 로직을 처리하지 않음
  • 복잡한 양식 시나리오에는 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

otp_screen

A new Flutter package for both android & iOS which helps developer in creating Otp screen with few lines of code.

Show some :heart: and star the repo to support the project

Screenshots


Usage

Example

To use this package:

    dependencies:
        flutter:
          sdk: flutter
        otp_screen: <latest-version>
How to use

  // logic to validate otp return [null] when success else error [String]
  Future<String> validateOtp(String otp) async {
    await Future.delayed(Duration(milliseconds: 2000));
    if (otp == "1234") {
      return null;
    } else {
      return "The entered Otp is wrong";
    }
  }

  // action to be performed after OTP validation is success
  void moveToNextScreen(context) {
    Navigator.push(context, MaterialPageRoute(
        builder: (context) => SuccessfulOtpScreen()));
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      // initialize the OTP screen by passing validation logic and route callback
      home: OtpScreen(
        otpLength: 4,
        validateOtp: validateOtp,
        routeCallback: moveToNextScreen,
        titleColor: Colors.black,
        themeColor: Colors.black,
      ),
    );
  }
}

The above code opens the simple OTP screen


Customize Options

You can play with different colors and add gradients as background to the screen

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: OtpScreen.withGradientBackground(
          topColor: Color(0xFFcc2b5e),
          bottomColor: Color(0xFF753a88),
          otpLength: 4,
          validateOtp: validateOtp,
          routeCallback: moveToNextScreen,
          themeColor: Colors.white,
          titleColor: Colors.white,
          title: "Phone Number Verification",
          subTitle: "Enter the code sent to \n +919876543210",
          icon: Image.asset(
            'images/phone_logo.png',
            fit: BoxFit.fill,
          ),
      ),

The output of the above code will open below screen.

Created & Maintained By

[Lokesh Chennamchetty] (https://github.com/lokesh-sudhakar)

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.