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
677 stars 330 forks source link

Looking up a deactivated widget's ancestor is unsafe. #339

Closed iPypeNB closed 1 year ago

iPypeNB commented 1 year ago

CODE:

Directionality( textDirection: TextDirection.ltr, child: Pinput( length: 6, controller: pinController, focusNode: focusNode, hapticFeedbackType: HapticFeedbackType.lightImpact, cursor: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ Container( margin: const EdgeInsets.only(bottom: 9), width: 22, height: 1, color: Colors.red, ), ], ), validator: (value) { return value == '222222' ? null : 'Pin is incorrect'; }, defaultPinTheme: pinTheme, focusedPinTheme: pinTheme.copyWith( decoration: pinTheme.decoration!.copyWith( borderRadius: BorderRadius.circular(8), border: Border.all(color: Color.fromRGBO(23, 171, 144, 1)), ), ), submittedPinTheme: pinTheme.copyWith( decoration: pinTheme.decoration!.copyWith( color: Color.fromRGBO(243, 246, 249, 0), borderRadius: BorderRadius.circular(19), border: Border.all(color: Color.fromRGBO(23, 171, 144, 1)), ), ), errorPinTheme: pinTheme.copyBorderWith( border: Border.all(color: Colors.redAccent), ), ), )

ERROR:

I am using the widget as shown in the example, when I try to enter the first number of the pinfield it tells me that I am losing reference to a parent widget, I guess it is because the dispose is being called where it should not be.

LOG: ════════ Exception caught by widgets library ═══════════════════════════════════ Looking up a deactivated widget's ancestor is unsafe. ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════ Looking up a deactivated widget's ancestor is unsafe. ════════════════════════════════════════════════════════════════════════════════