Pinput은 깔끔하고 사용자 정의 가능한 PIN 코드, OTP, 비밀번호 및 패스코드 입력 필드를 생성하기 위한 Flutter 패키지입니다. 일회용 코드에 대해 iOS 및 Android SMS 자동 완성 기능을 지원하여 2단계 인증, 두 단계 검증 또는 쿠폰 입력 시 사용자 경험을 향상시킵니다. 깔끔한 UI와 직관적인 제스처로 설계되어 웹, macOS, Windows, Linux 등 모든 주요 플랫폼에서 작동합니다. 부드러운 전환, 검증 및 인증 프로세스에의 간편한 통합이 가능합니다.
사용 사례
이중 인증
쿠폰 또는 프로모 코드 입력
보안 패스코드 입력
캡차 검증
OTP 로그인 흐름
비밀번호 복구
주요 기능
iOS 및 Android SMS 자동 완성 지원
사용자 정의 가능한 디자인 및 스타일링
크로스 플랫폼 호환성
필드 간 자동 포커스
내장 검증 유틸리티
부드러운 애니메이션
적합한 대상
인증 화면
보안 로그인 인터페이스
전자상거래 체크아웃 양식
사용자 온보딩 흐름
모바일 앱 보안 기능
고려 사항
OTP 제출 로직을 수동으로 처리해야 합니다
제한된 내장 오류 피드백
복잡한 워크플로우를 위해 추가 상태 관리가 필요할 수 있습니다
매우 긴 입력 시퀀스에 최적화되지 않음
내장된 생체 인식 통합 없음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Flutter pin code input
Need anything Flutter related? Reach out on LinkedIn
Flutter Pinput is a package that provides an easy-to-use and customizable Pin code input field. It offers several features such as animated decoration switching, form validation, SMS autofill, custom cursor, copying from clipboard, and more. It also provides beautiful examples that you can choose from.
The pin has 6 states defaultfocused, submitted, following, disabled, error, you can customize each state by specifying theme parameter.
Pin smoothly animates from one state to another automatically.
PinTheme Class
if you want all pins to be the same don't pass other theme parameters,
If not, create focusedPinTheme, submittedPinTheme, followingPinTheme, errorPinTheme from defaultPinTheme
/// Create Controller final pinController = TextEditingController();
/// Set text programmatically
pinController.setText('1222');
/// Append typed character, useful if you are using custom keyboard
pinController.append('1', 4);
/// Delete last character
pinController.delete();
/// Don't call setText, append, delete in build method, this is just illustration. returnPinput(
controller: pinController,
);
Focus
/// Create FocusNode final pinputFocusNode = FocusNode();
/// Focus pinput
pinputFocusNode.requestFocus();
/// UnFocus pinput
pinputFocusNode.unfocus();
/// Don't call requestFocus, unfocus in build method, this is just illustration. returnPinput(
focusNode: pinputFocusNode,
);
Validation
/// Create keyfinal formKey = GlobalKey<FormState>();
/// Validate manually/// Don't call validate in build method, this is just illustration.
formKey.currentState!.validate();
returnForm(
key: formKey,
child: Pinput(
// Without Validator// If true error state will be applied no matter what validator returns
forceErrorState: true,
// Text will be displayed under the Pinput
errorText: 'Error',
/// ------------/// With Validator/// Auto validate after user tap on keyboard done button, or completes Pinput
pinputAutovalidateMode: PinputAutovalidateMode.onSubmit,
validator: (pin) {
if (pin == '2224') returnnull;
/// Text will be displayed under the Pinputreturn'Pin is incorrect';
},
),
);
FAQ
autofill isn't working on iOS?
Make sure you are using real device, not simulator
Temporary replace Pinput with TextField, and check if autofill works. If, not it's probably a
problem with SMS you are getting, autofill doesn't work with most of the languages
If you are using non stable version of Flutter that might be cause because something might be
broken inside the Framework
are you using firebase_auth?
You should set controller's value in verificationCompleted callback, here is an example code: