3

There is no cursor while entering OTP, How can add Cursor in pinFieldAutoFill. I am using the sms_autofill: ^1.2.5 package.

                                 PinFieldAutoFill(
                                        autofocus: true,
                                        keyboardType: TextInputType.number,
                                        decoration: UnderlineDecoration(
                                          textStyle: TextStyle(
                                              fontSize: 44.sp,
                                              fontWeight: FontWeight.bold,
                                              color: kDarkBlue),
                                          colorBuilder: FixedColorBuilder(
                                              Colors.grey),
                                        ),
                                        currentCode: authService
                                            .loginMobileOTP, // prefill with a code
                                        onCodeSubmitted: (_) async {
                                          authService.login(
                                              context, _scaffoldKey);
                                        },
                                        onCodeChanged: (value) {
                                          authService.loginMobileOTP =
                                              value;
                                        },
                                        codeLength:
                                            6 //code length, default 6
                                        ),

1 Answers1

3

Please enable cursor option in "sms_autofill" package, class constructer "PinInputTextField".

Sharing reference code

return PinInputTextField(
  pinLength: widget.codeLength,
  decoration: widget.decoration,
  cursor: Cursor(
    width: 2,
    height: 40,
    color: Colors.red,
    radius: Radius.circular(1),
    enabled: true,
  ),
Rajesh M P
  • 477
  • 1
  • 10
  • 21