Pinput constructor
const
Pinput({
- int length = PinputConstants._defaultLength,
- PinTheme? defaultPinTheme,
- PinTheme? focusedPinTheme,
- PinTheme? submittedPinTheme,
- PinTheme? followingPinTheme,
- PinTheme? disabledPinTheme,
- PinTheme? errorPinTheme,
- ValueChanged<
String> ? onChanged, - ValueChanged<
String> ? onCompleted, - ValueChanged<
String> ? onSubmitted, - VoidCallback? onTap,
- VoidCallback? onLongPress,
- TextEditingController? controller,
- FocusNode? focusNode,
- Widget? preFilledWidget,
- JustIndexedWidgetBuilder? separatorBuilder,
- String smsCodeMatcher = PinputConstants.defaultSmsCodeMatcher,
- String? senderPhoneNumber,
- AndroidSmsAutofillMethod androidSmsAutofillMethod = AndroidSmsAutofillMethod.none,
- bool listenForMultipleSmsOnAndroid = false,
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
- AlignmentGeometry pinContentAlignment = Alignment.center,
- Curve animationCurve = Curves.easeIn,
- Duration animationDuration = PinputConstants._animationDuration,
- PinAnimationType pinAnimationType = PinAnimationType.scale,
- bool enabled = true,
- bool readOnly = false,
- bool useNativeKeyboard = true,
- bool toolbarEnabled = true,
- bool autofocus = false,
- bool obscureText = false,
- bool showCursor = true,
- bool isCursorAnimationEnabled = true,
- bool enableIMEPersonalizedLearning = false,
- bool enableSuggestions = true,
- HapticFeedbackType hapticFeedbackType = HapticFeedbackType.disabled,
- bool closeKeyboardWhenCompleted = true,
- TextInputType keyboardType = TextInputType.number,
- TextCapitalization textCapitalization = TextCapitalization.none,
- Offset? slideTransitionBeginOffset,
- Widget? cursor,
- Brightness? keyboardAppearance,
- List<
TextInputFormatter> inputFormatters = const [], - TextInputAction? textInputAction,
- Iterable<
String> ? autofillHints, - String obscuringCharacter = '•',
- Widget? obscuringWidget,
- TextSelectionControls? selectionControls,
- String? restorationId,
- ValueChanged<
String> ? onClipboardFound, - AppPrivateCommandCallback? onAppPrivateCommand,
- MouseCursor? mouseCursor,
- bool forceErrorState = false,
- String? errorText,
- FormFieldValidator<
String> ? validator, - PinputErrorBuilder? errorBuilder,
- TextStyle? errorTextStyle,
- PinputAutovalidateMode pinputAutovalidateMode = PinputAutovalidateMode.onSubmit,
- EdgeInsets scrollPadding = const EdgeInsets.all(20),
- EditableTextContextMenuBuilder? contextMenuBuilder = _defaultContextMenuBuilder,
- TapRegionCallback? onTapOutside,
- Key? key,
Creates a PinPut widget
Implementation
const Pinput({
this.length = PinputConstants._defaultLength,
this.defaultPinTheme,
this.focusedPinTheme,
this.submittedPinTheme,
this.followingPinTheme,
this.disabledPinTheme,
this.errorPinTheme,
this.onChanged,
this.onCompleted,
this.onSubmitted,
this.onTap,
this.onLongPress,
this.controller,
this.focusNode,
this.preFilledWidget,
this.separatorBuilder,
this.smsCodeMatcher = PinputConstants.defaultSmsCodeMatcher,
this.senderPhoneNumber,
this.androidSmsAutofillMethod = AndroidSmsAutofillMethod.none,
this.listenForMultipleSmsOnAndroid = false,
this.mainAxisAlignment = MainAxisAlignment.center,
this.crossAxisAlignment = CrossAxisAlignment.start,
this.pinContentAlignment = Alignment.center,
this.animationCurve = Curves.easeIn,
this.animationDuration = PinputConstants._animationDuration,
this.pinAnimationType = PinAnimationType.scale,
this.enabled = true,
this.readOnly = false,
this.useNativeKeyboard = true,
this.toolbarEnabled = true,
this.autofocus = false,
this.obscureText = false,
this.showCursor = true,
this.isCursorAnimationEnabled = true,
this.enableIMEPersonalizedLearning = false,
this.enableSuggestions = true,
this.hapticFeedbackType = HapticFeedbackType.disabled,
this.closeKeyboardWhenCompleted = true,
this.keyboardType = TextInputType.number,
this.textCapitalization = TextCapitalization.none,
this.slideTransitionBeginOffset,
this.cursor,
this.keyboardAppearance,
this.inputFormatters = const [],
this.textInputAction,
this.autofillHints,
this.obscuringCharacter = '•',
this.obscuringWidget,
this.selectionControls,
this.restorationId,
this.onClipboardFound,
this.onAppPrivateCommand,
this.mouseCursor,
this.forceErrorState = false,
this.errorText,
this.validator,
this.errorBuilder,
this.errorTextStyle,
this.pinputAutovalidateMode = PinputAutovalidateMode.onSubmit,
this.scrollPadding = const EdgeInsets.all(20),
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.onTapOutside,
Key? key,
}) : assert(obscuringCharacter.length == 1),
assert(length > 0),
assert(
textInputAction != TextInputAction.newline,
'Pinput is not multiline',
),
super(key: key);