sms_autofill icon indicating copy to clipboard operation
sms_autofill copied to clipboard

cannot change PinFieldAutoFill's background color

Open CartmanGD opened this issue 1 year ago • 3 comments

I'm using the sms_autofill package to create an SMS verification page. I use the PinFieldAutoFill widget to insert the sms code.

I want the background color of the widget to be white instead of grey:

image

How do I change it?

Here is my code:

PinFieldAutoFill(
      autoFocus: autoFocus,
      codeLength: smsCode.length,
      currentCode: autoComplete ? smsCode : null,
      decoration: BoxLooseDecoration(
        strokeColorBuilder: PinListenColorBuilder(Colors.black, Colors.black26),
        bgColorBuilder: const FixedColorBuilder(Colors.white),
        strokeWidth: 1.2,
      ),
      onCodeChanged: (p0) {
        if (p0?.length == smsCode.length && !autoComplete) {
          context.read<LoginBloc>().add(LoginEventSubmitSmsCode(p0!));
        }
      },
    );

CartmanGD avatar Mar 26 '23 12:03 CartmanGD

Is this package deprecated? Can anyone help here please?

CartmanGD avatar Mar 30 '23 07:03 CartmanGD

Hi @CartmanGD you can use this package : https://pub.dev/packages/otp_pin_field

shivam0139 avatar Apr 20 '23 18:04 shivam0139

you can surround PinFieldAutoFill with a theme widget like so:

Theme(
	data: Theme.of(context).copyWith(
	  inputDecorationTheme: Theme.of(context).inputDecorationTheme.copyWith(
			fillColor: Colors.transparent,
			filled: true,
		  ),
	),
	child: PinFieldAutoFill(
	  onCodeChanged: (code) {},
	),
  )

rsegecin avatar Aug 01 '24 23:08 rsegecin