Open danPyk opened 1 year ago
@danPyk i find some workaround you can reassign currentCode in onCodeChanged method -
onCodeChanged: (code) {
otpCode = code;
},
String? otpCode = "";
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: PinFieldAutoFill(
cursor:
Cursor(color: AppColor.colorPrimary, height: 10),
codeLength: 4,
onCodeChanged: (code) {
otpCode = code; // reasign otp code herer
},
onCodeSubmitted: (sub) {
// submitCode(sub, context);
},
controller: _controller,
currentCode: otpCode, //it show curent otp data
autoFocus: false,
decoration: BoxLooseDecoration(
textStyle: Styles.mediumTextStyle(
size: 26, color: AppColor.colorPrimary),
strokeColorBuilder: PinListenColorBuilder(
AppColor.colorPrimary,
Colors.grey.withOpacity(0.5)),
bgColorBuilder: PinListenColorBuilder(
Colors.white, Colors.white),
), ),
),
),
I have a problem, which occurs only on physical phone, on iOS and Android emulators everything works fine. When I finished type verification code and then minimise keyboard, field became empty. I've tried to debug this and noticed, that anonymous parameter of onCodeChanged is empty after closing keyboard.
Phone is Moto G8 with Android 11.