Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add cursor For PinFieldAutoFill flutter

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
                                        ),
like image 650
Muzammil Dafedar Avatar asked Nov 24 '25 21:11

Muzammil Dafedar


1 Answers

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,
  ),
like image 116
Rajesh M P Avatar answered Nov 27 '25 01:11

Rajesh M P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!