adar2378 / pin_code_fields

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs 🤓🤓
https://pub.dev/packages/pin_code_fields
MIT License
690 stars 336 forks source link

How can I delete after completion? #282

Closed abdullah017 closed 1 year ago

abdullah017 commented 2 years ago

When we complete all the character fields, it becomes unfocused and we cannot delete it, can you help with this?

Package; always last version

Flutter doctor:

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale
    tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

My Code;

PinCodeTextField(
          length: 6,
          obscureText: false,
          animationType: AnimationType.fade,
          focusNode: controller.myFocusNode,
          autoDisposeControllers: false,
          autoFocus: true,
          autoUnfocus: false,
          pinTheme: PinTheme(
              inactiveColor: Colors.grey.shade300, //inactive border side
              inactiveFillColor: AppColors.WHITE_OPACITY,

              ///inactive background
              activeColor: Colors.white,
              activeFillColor: AppColors.ORANGE,
              selectedColor: AppColors.ORANGE,
              selectedFillColor: AppColors.ORANGE,
              shape: PinCodeFieldShape.box,
              borderRadius: BorderRadius.circular(5),
              fieldHeight: 50,
              fieldWidth: 40,
              fieldOuterPadding: EdgeInsets.all(3)),
          animationDuration: Duration(milliseconds: 300),
          enableActiveFill: true,
          errorAnimationController: controller.errorController,
          controller: controller.textEditingController,
          validator: (value) {
            if (value == null || value.length < 6) {
              print(value);
              controller.hasError.value = true;

              return "";
            } else {
              return null;
            }
          },
          onCompleted: (v) {
            print("Completed");
            controller.myFocusNode;
          },
          onChanged: (value) {
            print(value);

            controller.currentText.value = value;
          },
          beforeTextPaste: (text) {
            print("Allowing to paste $text");
            //if you return true then it will show the paste confirmation dialog. Otherwise if false, then nothing will happen.
            //but you can show anything you want here, like your pop up saying wrong paste format or etc
            return true;
          },
          appContext: Get.context!),
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.