otp_textfield icon indicating copy to clipboard operation
otp_textfield copied to clipboard

Unable to ts set numberOfFields to 6

Open abisao1 opened this issue 2 years ago • 2 comments

Am failing to set numberOfFields prop to 6. This is the error am getting: RangeError (index): Invalid value: Not in inclusive range 0..4: 5

abisao1 avatar Nov 12 '22 10:11 abisao1

I had the same issue.

If you don`t want to use different text styles for each field than comment this if statement in Widget generateTextFields in the flutter_otp_text_field.dart. After this you should be able to use more than 5 fields.

/* if (widget.styles.length > 0) {
        return _buildTextField(
          context: context,
          index: i,
          style: widget.styles[i],
        );
      } */

SebastianWelscher avatar Feb 18 '24 19:02 SebastianWelscher

Wrapping with Flexible() worked for me!

AndersonCRocha avatar Jun 03 '24 20:06 AndersonCRocha