field method

Widget field(
  1. BuildContext context
)

Implementation

Widget field(BuildContext context) {
  final trailingWidget = buildTrailingIcon();
  return Stack(children: [
    Container(
        height: 56.0,
        padding: style.textFieldInnerPadding,
        decoration: BoxDecoration(
          color: style.textFieldBackground,
          borderRadius: style.textFieldRadius,
          border: errorBorder ? style.errorBorder : style.border,
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
              child: Center(
                child: TextFormField(
                  controller: controller,
                  autofillHints: autoFillHints,
                  autofocus: autoFocus,
                  initialValue: initialValue,
                  onChanged: onChange,
                  enabled: enabled,
                  style: style.fieldTextStyle,
                  keyboardType: textInputType,
                  textInputAction: inputAction,
                  onFieldSubmitted: onSubmit,
                  decoration: InputDecoration(
                    isDense: true,
                    border: InputBorder.none,
                    hintText: hint,
                    hintStyle: style.textFieldHint,
                  ),
                  cursorHeight: (style.fieldTextStyle.fontSize! *
                          (style.fieldTextStyle.height ?? 1)) -
                      1,
                  textAlign: style.textAlign,
                ),
              ),
            ),
            if (trailingWidget != null) trailingWidget
          ],
        )),
    if (dottedLine)
      Positioned.fill(
        child: Align(
          alignment: style.dottedLineAlignment,
          child: SizedBox(
            width: style.dottedLineWidth,
            child: DottedLine(
              dashColor:
                  error ? style.dottedLineErrorColor : style.dottedLineColor,
              dashLength: style.dotLength,
            ),
          ),
        ),
      )
  ]);
}