FancyFlatButton.icon constructor

const FancyFlatButton.icon(
  1. {Key key,
  2. bool isEnabled,
  3. @required VoidCallback onPressed,
  4. @required Widget icon,
  5. @required Widget label,
  6. bool isLoading: false,
  7. Widget loadingLabel,
  8. Color textColor,
  9. Color color,
  10. ShapeBorder shape}
)

Creates a FlatButton with a leading icon.

Use isEnabled to avoid ternary statements for onPressed — you can disable the button with:

  • isEnabled: false or
  • onPressed: null

child, icon and isLoading must not be null.

Implementation

const FancyFlatButton.icon({
  Key key,
  bool isEnabled,
  @required VoidCallback onPressed,
  @required Widget icon,
  @required Widget label,
  bool isLoading = false,
  Widget loadingLabel,
  Color textColor,
  Color color,
  ShapeBorder shape,
})  : assert(icon != null),
      super(
        key: key,
        isEnabled: isEnabled,
        onPressed: onPressed,
        icon: icon,
        child: label,
        isLoading: isLoading,
        loadingChild: loadingLabel,
        textColor: textColor,
        color: color,
        shape: shape,
      );