Repository: flutter
Issue: prefixIconError or a boolean in the InputDecoration props ?
Labels: a: text input,framework,f: material design,c: proposal,team-design,triaged-design

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill our the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

I use an InputDecoration to display some icon at the left of my input using the prefixIcon props.
In case of error, I can style the text, the border, but I cannot touch the prefix

I've added a bool hasError when I call my InputDecoration from the field, but I need to know if the field is in "error" and it is very difficult... and almost invisible. I need to map fields of the form and get there status.

```
  bool isFieldInError(String key) {
    try {
      final field =
          (formKey != null ? formKey?.currentState?.fields[key] : null);
      return field?.currentState != null && field.currentState.hasError;
    } catch (e) {
      return false;
    }
  }
```

And my InputDecoration is 

```
InputDecoration formFieldDecoration(
        {BuildContext context,
        String hintText,
        IconData icon,
        bool hasError = false}) =>
    InputDecoration(
      hintText: hintText,
      hintStyle:
          TextStyle(color: WMColors.greyDimmed, fontSize: WMTypos.sizeDefault),
      hintMaxLines: 1,
      errorStyle:
          TextStyle(fontSize: WMTypos.sizeSmall, color: WMColors.danger),
      errorMaxLines: 2,
      hasFloatingPlaceholder: false,
      isDense: true,
      contentPadding: EdgeInsets.all(0),
      prefixIcon: Container(
        width: 45,
        height: 45,
        padding: const EdgeInsets.all(0),
        margin: const EdgeInsets.only(right: WMDimensions.space2x),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(3),
          color: hasError ? WMColors.danger : WMColors.grey,
        ),
        child: Icon(
          icon,
          color: WMColors.white,
          size: 14,
        ),
      ),
    );
```

![flutter-form-builder](https://user-images.githubusercontent.com/7458151/76883802-fbebf600-687c-11ea-8fdf-fe2c4586ac84.gif)


## Proposal

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching images showing what you are imagining.

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->

1. Having some kind of prefixIconError

```
    InputDecoration(
...
      prefixIcon: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(3),
          color: WMColors.grey,
        ),
        child: Icon(
          icon,
          color: WMColors.white,
          size: 14,
        ),
      ),
      prefixIconError: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(3),
          color: WMColors.danger,
        ),
        child: Icon(
          icon,
          color: WMColors.white,
          size: 14,
        ),
      ),
    );
```

2. Having the information that the field is in error and having this passed in the InputDecoration props

3. Having an event for the form onError with a map of fields in error as props...

```
class Form extends StatefulWidget {
  /// Creates a container for form fields.
  ///
  /// The [child] argument must not be null.
  const Form({
    Key key,
    @required this.child,
    this.autovalidate = false,
    this.onWillPop,
    this.onChanged,
    **this.onError,**
  }) : assert(child != null),
       super(key: key);

```

Thank you !