v0.0.3
otp_screen
간단한 코드로 OTP 화면을 만들 수 있도록 도와주는 새로운 Flutter 패키지입니다.
28좋아요 1830일 다운로드30Pub 점수
플랫폼 정보 없음
간단한 코드로 OTP 화면을 만들 수 있도록 도와주는 새로운 Flutter 패키지입니다.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A new Flutter package for both android & iOS which helps developer in creating Otp screen with few lines of code.


To use this package:
dependencies:
flutter:
sdk: flutter
otp_screen: <latest-version>
// 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
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.
[Lokesh Chennamchetty] (https://github.com/lokesh-sudhakar)
의존성 목록 3 개
{"sdk":"flutter"}^6.0.1{"sdk":"flutter"}사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗