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

GitHub 저장소lokesh-sudhakar/Flutter-OtpScreen

Flutter-OtpScreen

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

Flutter-OtpScreen 프로젝트 이미지
스타
10
포크
8
최근 푸시(UTC)
2023. 8. 27.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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)

Lokesh Chennamchetty GitHub avatar
GitHub 작성자

Lokesh Chennamchetty ↗

@lokesh

언어DartHTMLSwiftJavaObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개

  • flutter{"sdk":"flutter"}
  • fluttertoast^6.0.1
  • flutter_test개발 의존성{"sdk":"flutter"}

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗