pin static method

Widget pin({
  1. required dynamic onChanged(
    1. String
    ),
  2. required int length,
  3. required VoidCallback onTap,
  4. required String buttonText,
  5. required bool isLoading,
  6. required bool isComplete,
  7. dynamic onCompleted(
    1. String
    )?,
  8. String description = 'Masukkan PIN Transaksi Anda',
  9. String buttonType = 'default',
  10. TextInputType keyboardType = TextInputType.number,
  11. bool obscureText = true,
  12. BorderRadius? borderRadius,
  13. Color? inactiveColor,
  14. Color? activeColor,
  15. PinCodeFieldShape pinCodeFieldShape = PinCodeFieldShape.box,
  16. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  17. CrossAxisAlignment crossAxisAlignmen = CrossAxisAlignment.stretch,
})

Implementation

static Widget pin({
  required Function(String) onChanged,
  required int length,
  required VoidCallback onTap,
  required String buttonText,
  required bool isLoading,
  required bool isComplete,
  Function(String)? onCompleted,
  String description = 'Masukkan PIN Transaksi Anda',
  String buttonType = 'default',
  TextInputType keyboardType = TextInputType.number,
  bool obscureText = true,
  BorderRadius? borderRadius,
  Color? inactiveColor,
  Color? activeColor,
  PinCodeFieldShape pinCodeFieldShape = PinCodeFieldShape.box,
  MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  CrossAxisAlignment crossAxisAlignmen = CrossAxisAlignment.stretch,
}) {
  return Column(
    crossAxisAlignment: crossAxisAlignmen,
    mainAxisAlignment: mainAxisAlignment,
    children: [
      SizedBox(height: 10.h),
      Center(
        child: Texts.caption(description),
      ),
      SizedBox(height: 20.h),
      PinCodeTextField(
        appContext: Get.context!,
        length: 6,
        onChanged: (value) {},
        onCompleted: onCompleted,
        keyboardType: keyboardType,
        obscureText: obscureText,
        pinTheme: PinTheme(
          shape: pinCodeFieldShape,
          borderRadius: BorderRadius.circular(10.r),
          inactiveColor: Get.theme.shadowColor,
          activeColor: Get.theme.primaryColor,
          selectedColor: Get.theme.primaryColor,
        ),
      ),
      isLoading
          ? Padding(
              padding: EdgeInsets.only(top: 10.h),
              child: LoadingActivity.platformLoading(
                color: Get.theme.primaryColor,
                size: 40.sp,
              ),
            )
          : AbsorbPointer(
              absorbing: !isComplete,
              child: Buttons.defaultButton(
                fillColor: isComplete
                    ? Get.theme.primaryColor
                    : Get.theme.shadowColor,
                handler: onTap,
                widget: Texts.button('Submit'),
              ),
            ),
    ],
  );
}