Поехала верстка в поле TextField сообщение об ошибке

Поля создаются одинаково во всех случаях:

TextField(
      keyboardType: widget.fieldType,
      onChanged: widget.onChange,
      onSubmitted: widget.onSubmited,
      controller: widget.controller,
      scrollPadding: EdgeInsets.zero,
      focusNode: _textFieldFocus,
      cursorColor: kWhite,
      maxLength: widget.maxLength,
      style: TextStyle(
        color: kWhite,
        fontSize: 14.0.sp,
        fontWeight: FontWeight.w500,
      ),
      decoration: InputDecoration(
        contentPadding: EdgeInsets.fromLTRB(3.0.w, 10.0, 3.0.w, 1.8.h),
        enabledBorder: OutlineInputBorder(
          borderSide: (widget.errorbool != null && widget.errorbool!) ||
                  (widget.secondErrorbool != null &&
                      widget.secondErrorbool!)
              ? const BorderSide(color: kRed)
              : const BorderSide(color: kGrey),
          borderRadius: BorderRadius.circular(12.0),
        ),
        focusedBorder: OutlineInputBorder(
          borderSide: (widget.errorbool != null && widget.errorbool!) ||
                  (widget.secondErrorbool != null &&
                      widget.secondErrorbool!)
              ? const BorderSide(color: kRed)
              : const BorderSide(color: kViolet),
          borderRadius: BorderRadius.circular(12.0),
        ),
        focusColor: kVioletDark,
        filled: true,
        fillColor: _color,
      ),
    ),
     SizedBox(
      height: 1.0.h,
    ),
    Row(
      mainAxisAlignment: MainAxisAlignment.end,
      children: [
        if (widget.errorbool != null)
          if (widget.errorbool!)
            Flexible (
                child: Text(
              '${widget.errorText}',
              style: const TextStyle(
                color: kRed,
              ),
            ),
            )
          else if (widget.secondErrorbool != null)
            widget.secondErrorbool!
                ? Flexible(
                  child: Text(
                    '${widget.secondErrorText}',
                    style: const TextStyle(
                      color: kRed,
                    ),
                  ),
            )
                : Container()
      ],
    ),
  ],
);

} }

Сама верстка страницы:

SliverList(
                      delegate: SliverChildBuilderDelegate(
                            (context, index) {
                          return SizedBox(
                            height: MediaQuery
                                .of(context)
                                .size
                                .height - 37.0.h,
                            child: Padding(
                              padding: EdgeInsets.symmetric(horizontal: 5.0.w, vertical: 1.0.h),
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment
                                    .spaceBetween,
                                children: [
                                  Column(
                                    children: [
                                       SizedBox(
                                        height: 4.4.h,
                                      ),
                                      CustomTextField(...),
                                      SizedBox(
                                        height: 1.5.h,
                                      ),
                                      CustomTextFieldPassword(...),
                                       SizedBox(
                                        height: 1.5.h,
                                      ),
                                      const CustomText(),
                                       SizedBox(
                                        height: 1.0.h,
                                      ),
                                    ],
                                  ),

расстояние между полем и ошибкой во втором случае уезжает

Расстояние во втором случае не получается уменьшить, не могу понять в чем проблема.


Ответы (1 шт):

Автор решения: mterresa

Проблема была в отображении maxLength:, просто добавил counterText: "".

→ Ссылка