How to display error label in Cupertino TextField

Viewed 1256

I am trying to display an error text below a Cupertino TextField if the field is empty after a user pushes my login button. There seems to be no clear cut way to display an error label below the textfield like on android in any of the CupertinoTextfield parameters.

How do I achieve this?

Here is my code

CupertinoTextField(
        key: widget.key,
        keyboardType: widget.textInputType,
        placeholder: widget.errorText ?? widget.hint,
        style: widget.style,
        onChanged: widget.onChanged,
        enabled: widget.enabled,
        controller: widget.textEditingController,
        focusNode: _focusNode,
        obscureText: widget.obscureText,
        enableSuggestions: widget.enableSuggestions,
        autocorrect: widget.autocorrect,
        clearButtonMode: OverlayVisibilityMode.editing,
        padding: widget.iosPaddings != null
            ? widget.iosPaddings!
            : const EdgeInsets.all(4),
      );
1 Answers
Related