multilineTextField static method

Widget multilineTextField({
  1. Key? key,
  2. required TextInputAction textInputAction,
  3. required TextInputType textInputType,
  4. required bool isLoading,
  5. required TextFieldController textFieldController,
  6. IconData? iconData,
  7. String? initialValue,
  8. int minLines = 3,
  9. int maxLines = 5,
  10. String? fontFamily,
})

Implementation

static Widget multilineTextField({
  Key? key,
  required TextInputAction textInputAction,
  required TextInputType textInputType,
  required bool isLoading,
  required TextFieldController textFieldController,
  IconData? iconData,
  String? initialValue,
  int minLines = 3,
  int maxLines = 5,
  String? fontFamily,
}) {
  return AnimatedSize(
    duration: const Duration(milliseconds: 300),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          margin: EdgeInsets.only(
            top: 10.h,
          ),
          padding: EdgeInsets.symmetric(horizontal: 8.w),
          decoration: BoxDecoration(
            color: Get.theme.colorScheme.background,
            borderRadius: BorderRadius.all(Radius.circular(10.r)),
            border: Border.all(
              width: 1,
              color: !textFieldController.isValid
                  ? Get.theme.colorScheme.error
                  : Get.theme.shadowColor,
            ),
          ),
          child: TextFormField(
            style: GoogleFonts.getFont(
              fontFamily ?? (Platform.isIOS ? 'Open Sans' : 'Roboto'),
            ),
            initialValue: textFieldController.text,
            enabled: !isLoading,
            obscureText: textFieldController.obscureText &&
                !textFieldController.visible,
            textInputAction: textInputAction,
            keyboardType: textInputType,
            onChanged: textFieldController.onChange,
            minLines: minLines,
            maxLines: maxLines,
            decoration: InputDecoration(
              hintStyle: GoogleFonts.getFont(
                fontFamily ?? (Platform.isIOS ? 'Open Sans' : 'Roboto'),
              ),
              border: InputBorder.none,
              focusedBorder: InputBorder.none,
              enabledBorder: InputBorder.none,
              errorBorder: InputBorder.none,
              disabledBorder: InputBorder.none,
              contentPadding:
                  EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
              hintText: textFieldController.title,
              icon: iconData == null
                  ? null
                  : Icon(
                      iconData,
                    ),
              filled: true,
              fillColor: Colors.transparent,
            ),
          ),
        ),
        AnimatedSize(
          duration: const Duration(milliseconds: 300),
          child: !textFieldController.isValid
              ? Padding(
                  padding: EdgeInsets.all(8.0.spMin),
                  child: Texts.overline(
                    textFieldController.errorMessage,
                    color: Get.theme.colorScheme.error,
                    textOverflow: TextOverflow.visible,
                  ),
                )
              : const SizedBox(),
        ),
      ],
    ),
  );
}