centerSpacing property

double? centerSpacing
final

Extra spacing applied at the middle of the OTP fields.

When not null, adds extra space at the middle index (length / 2). This is commonly used for 6-digit OTPs to group them as "XXX XXX".

  • For 6 fields: spacing between 3rd and 4th field
  • For 4 fields: spacing between 2nd and 3rd field
  • If null, uniform fieldSpacing is used throughout

Example:

// Create "123 456" layout
OTPTextField(
  controllers: controllers, // length 6
  focusNodes: focusNodes,
  centerSpacing: 16,
)

Implementation

final double? centerSpacing;