OTPTextField constructor
const
OTPTextField({
- Key? key,
- TextEditingController? controller,
- FocusNode? focusNode,
- void onCompleted()?,
- void onChanged()?,
- void onSubmitted()?,
- int length = 6,
- OTPStyle style = OTPStyle.boxed,
- OTPAnimationType animationType = OTPAnimationType.slide,
- double? pinWidth,
- double? pinHeight,
- double? spacing,
- double? borderRadius,
- double borderWidth = 1.5,
- Color? defaultBorderColor,
- Color? focusedBorderColor,
- Color? submittedBorderColor,
- Color? errorBorderColor,
- Color? successBorderColor,
- Color? fillColor,
- Color? focusedFillColor,
- Color? submittedFillColor,
- Color? errorFillColor,
- Color? successFillColor,
- Color? textColor,
- double? fontSize,
- FontWeight? fontWeight,
- String? fontFamily,
- TextStyle? textStyle,
- bool obscureText = false,
- String obscuringCharacter = '•',
- Widget? obscuringWidget,
- bool showCursor = true,
- Color? cursorColor,
- double cursorWidth = 2,
- double? cursorHeight,
- Widget? cursor,
- TextInputType keyboardType = TextInputType.number,
- TextInputAction textInputAction = TextInputAction.done,
- bool autofocus = false,
- bool readOnly = false,
- bool enabled = true,
- bool enableSuggestions = false,
- bool useNativeKeyboard = true,
- bool hapticFeedback = true,
- bool autoSubmit = false,
- bool closeKeyboardOnComplete = true,
- String? validator()?,
- String? errorText,
- bool hasError = false,
- bool isSuccess = false,
- Duration errorAnimationDuration = const Duration(milliseconds: 300),
- bool showErrorAnimation = true,
- List<
TextInputFormatter> ? inputFormatters, - Iterable<
String> ? autofillHints, - bool enableIMEPersonalizedLearning = false,
- Widget contextMenuBuilder()?,
- VoidCallback? onTap,
- VoidCallback? onLongPress,
- void onTapOutside()?,
- MouseCursor? mouseCursor,
- bool forceErrorState = false,
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
- AlignmentGeometry pinContentAlignment = Alignment.center,
- Widget separatorBuilder(
- int index
- Widget? preFilledWidget,
- PinTheme? followingPinTheme,
- PinTheme? disabledPinTheme,
- PinTheme? errorPinTheme,
- String? semanticLabel,
- bool? enableSecurity,
Implementation
const OTPTextField({
super.key,
this.controller,
this.focusNode,
this.onCompleted,
this.onChanged,
this.onSubmitted,
this.length = 6,
this.style = OTPStyle.boxed,
this.animationType = OTPAnimationType.slide,
this.pinWidth,
this.pinHeight,
this.spacing,
this.borderRadius,
this.borderWidth = 1.5,
this.defaultBorderColor,
this.focusedBorderColor,
this.submittedBorderColor,
this.errorBorderColor,
this.successBorderColor,
this.fillColor,
this.focusedFillColor,
this.submittedFillColor,
this.errorFillColor,
this.successFillColor,
this.textColor,
this.fontSize,
this.fontWeight,
this.fontFamily,
this.textStyle,
this.obscureText = false,
this.obscuringCharacter = '•',
this.obscuringWidget,
this.showCursor = true,
this.cursorColor,
this.cursorWidth = 2,
this.cursorHeight,
this.cursor,
this.keyboardType = TextInputType.number,
this.textInputAction = TextInputAction.done,
this.autofocus = false,
this.readOnly = false,
this.enabled = true,
this.enableSuggestions = false,
this.useNativeKeyboard = true,
this.hapticFeedback = true,
this.autoSubmit = false,
this.closeKeyboardOnComplete = true,
this.validator,
this.errorText,
this.hasError = false,
this.isSuccess = false,
this.errorAnimationDuration = const Duration(milliseconds: 300),
this.showErrorAnimation = true,
this.inputFormatters,
this.autofillHints,
this.enableIMEPersonalizedLearning = false,
this.contextMenuBuilder,
this.onTap,
this.onLongPress,
this.onTapOutside,
this.mouseCursor,
this.forceErrorState = false,
this.mainAxisAlignment = MainAxisAlignment.center,
this.crossAxisAlignment = CrossAxisAlignment.center,
this.pinContentAlignment = Alignment.center,
this.separatorBuilder,
this.preFilledWidget,
this.followingPinTheme,
this.disabledPinTheme,
this.errorPinTheme,
this.semanticLabel,
this.enableSecurity,
});