textFieldA function

Widget textFieldA({
  1. Key? key,
  2. required TextEditingController controller,
  3. required String hintText,
  4. bool? obscureText = false,
  5. TextAlign textAlign = TextAlign.start,
  6. Icon? prefixIcon,
  7. double? internalPadding,
  8. void onChanged(
    1. String
    )?,
  9. void onSubmitted(
    1. String
    )?,
})

Custom TextField widget with common styling.

Used to create a customized text input field.

Parameters:

  • controller: Controller for the text input.
  • hintText: Hint text displayed in the input field.
  • obscureText: Whether the text should be obscured (e.g., for passwords).
  • textAlign: Text alignment within the input field.
  • prefixIcon: Icon to be displayed before the input text.
  • internalPadding: Padding within the input field.
  • onChanged: Callback function when the text is changed.
  • onSubmitted: Callback function when the user submits the input.

Implementation

Widget textFieldA({
  Key? key,
  required TextEditingController controller,
  required String hintText,
  bool? obscureText = false,
  TextAlign textAlign = TextAlign.start,
  Icon? prefixIcon,
  double? internalPadding,
  void Function(String)? onChanged,
  void Function(String)? onSubmitted,
}) {
  return TextField(
    key: key,
    controller: controller,
    obscureText: obscureText ?? false,
    cursorColor: HexColor("#4f4f4f"),
    textAlign: textAlign,
    decoration: InputDecoration(
      hintText: hintText,
      fillColor: HexColor("#f2f3ff"),
      contentPadding: EdgeInsets.all(internalPadding ?? 20),
      hintStyle: GoogleFonts.almarai(
        fontSize: 15,
        color: Colors.black87,
      ),
      border: OutlineInputBorder(
        borderRadius: BorderRadius.circular(30),
        borderSide: BorderSide.none,
      ),
      prefixIcon: prefixIcon,
      prefixIconColor: HexColor("#4f4f4f"),
      filled: true,
    ),
    onChanged: onChanged,
    onSubmitted: onSubmitted,
  );
}