DEV Community

loading...

Discussion on: Star Rating with Flutter Reactive Forms

joanpablo profile image
Joan Pablo Author • Edited

There you have an InputDecoration. You should avoid using validator, and instead use the errorText of the decoration. You can search for the implementation of the ReactiveTextField to see how it is using this approach.

builder: (ReactiveFormFieldState field) {
   final state = field as _ReactiveTextFieldState;
   final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration())
   .applyDefaults(Theme.of(state.context).inputDecorationTheme);

   return DateTimePicker(
      decoration: effectiveDecoration.copyWith(errorText: state.errorText),
   );         

Enter fullscreen mode Exit fullscreen mode

In the above code, I'm not using your RDateTimePicker just to simplify things, but it also applies with your wrapper widget.

Thread Thread
inmer profile image
Inmer

Thank you, Joan finally I was able to make it work for both cases, greatly appreciate your help.