otpTextField function

Widget otpTextField({
  1. int length = 4,
  2. bool autoFocus = false,
  3. TextEditingController? controller,
  4. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceBetween,
  5. String? hintCharacter,
  6. void onCompleted(
    1. String
    )?,
  7. double borderRadius = 8,
  8. PinCodeFieldShape shape = PinCodeFieldShape.box,
  9. EdgeInsetsGeometry? fieldOuterPadding,
  10. double fieldHeight = 64,
  11. double fieldWidth = 60,
  12. double borderWidth = 1,
  13. Color? fillColor,
  14. Color? cursorColor,
  15. Color? borderColor,
})

Implementation

Widget otpTextField({
  final int length = 4,
  final bool autoFocus = false,
  final TextEditingController? controller,
  final MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceBetween,
  final String? hintCharacter,
  final void Function(String)? onCompleted,
  final double borderRadius = 8,
  final PinCodeFieldShape shape = PinCodeFieldShape.box,
  final EdgeInsetsGeometry? fieldOuterPadding,
  final double fieldHeight = 64,
  final double fieldWidth = 60,
  final double borderWidth = 1,
  final Color? fillColor,
  final Color? cursorColor,
  final Color? borderColor,
}) =>
    PinCodeTextField(
      controller: controller,
      appContext: context,
      length: length,
      autoFocus: autoFocus,
      cursorColor: cursorColor,
      mainAxisAlignment: mainAxisAlignment,
      hintCharacter: hintCharacter,
      animationType: AnimationType.fade,
      pinTheme: PinTheme(
        shape: shape,
        fieldOuterPadding: fieldOuterPadding,
        borderRadius: BorderRadius.circular(borderRadius),
        fieldHeight: fieldHeight,
        fieldWidth: fieldWidth,
        borderWidth: borderWidth ,
        activeFillColor: fillColor,
        inactiveFillColor: fillColor,
        selectedFillColor: fillColor,
        inactiveColor: borderColor,
        selectedColor: borderColor,
        activeColor: borderColor,
      ),
      enableActiveFill: true,
      keyboardType: TextInputType.number,
      onCompleted: onCompleted,
      onChanged: (final _) {},
    ).ltr();