otpInputDecoration method

InputDecoration otpInputDecoration({
  1. required String hint,
  2. String? label,
})

Decoration for the OTP input field.

Implementation

InputDecoration otpInputDecoration({required String hint, String? label}) {
  OutlineInputBorder border(Color c, [double w = 1]) => OutlineInputBorder(
    borderSide: BorderSide(color: c, width: w),
    borderRadius: BorderRadius.circular(inputRadius),
  );
  return InputDecoration(
    labelText: label,
    hintText: hint,
    filled: true,
    fillColor: theme.inputBackground,
    hintStyle: TextStyle(
      fontFamily: fontFamily,
      color: theme.onSurfaceMuted,
      letterSpacing: 4,
    ),
    labelStyle: TextStyle(
      fontFamily: fontFamily,
      color: theme.onSurfaceMuted,
    ),
    contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
    border: border(theme.inputBorder),
    enabledBorder: border(theme.inputBorder),
    focusedBorder: border(theme.primary, 1.5),
    errorBorder: border(Colors.redAccent),
    focusedErrorBorder: border(Colors.redAccent, 1.5),
  );
}