createInputDecoration static method

InputDecoration createInputDecoration({
  1. required BuildContext context,
  2. required bool isChanged,
  3. String? placeholder,
  4. String? label,
  5. double? maxHeight,
  6. String? helper,
})

Implementation

static InputDecoration createInputDecoration({
  required BuildContext context,
  required bool isChanged,
  String? placeholder,
  String? label,
  double? maxHeight,
  String? helper,
}) {
  const OutlineInputBorder border = OutlineInputBorder();

  final InputDecoration effectiveDecoration = InputDecoration(
    hintText: placeholder,
    labelText: label,
    border: border,
    enabledBorder: isChanged
        ? border.copyWith(
            borderSide: BorderSide(
              color: context.kitColors.successColor,
            ),
          )
        : null,
    focusedBorder: isChanged
        ? border.copyWith(
            borderSide: BorderSide(
              color: context.kitColors.successColor,
              width: 2,
            ),
          )
        : null,
    errorMaxLines: 1,
    isDense: true,
    constraints: maxHeight == null ? null : BoxConstraints(maxHeight: maxHeight),
    helperText: helper,
    filled: true,
  );
  return effectiveDecoration;
}