buttonStyleFrom function

ButtonStyle buttonStyleFrom({
  1. Color? foregroundColor,
  2. Color? backgroundColor,
  3. Color? hoverColor,
  4. Color? pressColor,
  5. Color? selectionColor,
  6. Color? focusColor,
  7. Color? shadowColor,
  8. double? elevation,
  9. TextStyle? textStyle,
  10. EdgeInsetsGeometry? padding,
  11. Size? minimumSize,
  12. Size? fixedSize,
  13. Size? maximumSize,
  14. BorderSide? side,
  15. OutlinedBorder? shape,
  16. MouseCursor? enabledMouseCursor,
  17. MouseCursor? disabledMouseCursor,
  18. VisualDensity? visualDensity,
  19. MaterialTapTargetSize? tapTargetSize,
  20. Duration? animationDuration,
  21. bool? enableFeedback,
  22. AlignmentGeometry? alignment,
  23. InteractiveInkFeatureFactory? splashFactory,
})

Implementation

ButtonStyle buttonStyleFrom({
  Color? foregroundColor,
  Color? backgroundColor,
  Color? hoverColor,
  Color? pressColor,
  Color? selectionColor,
  Color? focusColor,
  Color? shadowColor,
  double? elevation,
  TextStyle? textStyle,
  EdgeInsetsGeometry? padding,
  Size? minimumSize,
  Size? fixedSize,
  Size? maximumSize,
  BorderSide? side,
  OutlinedBorder? shape,
  MouseCursor? enabledMouseCursor,
  MouseCursor? disabledMouseCursor,
  VisualDensity? visualDensity,
  MaterialTapTargetSize? tapTargetSize,
  Duration? animationDuration,
  bool? enableFeedback,
  AlignmentGeometry? alignment,
  InteractiveInkFeatureFactory? splashFactory,
}) {
  final MaterialStateProperty<Color?>? foregroundColorStateProperty =
    foregroundColor != null ? ButtonDefaultForeground(foregroundColor) : null;

  final MaterialStateProperty<MouseCursor>? mouseCursor =
    enabledMouseCursor != null && disabledMouseCursor != null ?
      ButtonDefaultMouseCursor(enabledMouseCursor, disabledMouseCursor) : null;

  return ButtonStyle(
    textStyle: MaterialStatePropertyAll.orNull(textStyle),
    backgroundColor: MaterialStatePropertyAll.orNull(backgroundColor),
    foregroundColor: foregroundColorStateProperty,
    overlayColor: ButtonRichStateProperty.onNull(hoverColor, pressColor, selectionColor, focusColor),
    shadowColor: MaterialStatePropertyAll.orNull(shadowColor),
    elevation: MaterialStatePropertyAll.orNull(elevation),
    padding: MaterialStatePropertyAll.orNull(padding),
    minimumSize: MaterialStatePropertyAll.orNull(minimumSize),
    fixedSize: MaterialStatePropertyAll.orNull(fixedSize),
    maximumSize: MaterialStatePropertyAll.orNull(maximumSize),
    side: MaterialStatePropertyAll.orNull(side),
    shape: MaterialStatePropertyAll.orNull(shape),
    mouseCursor: mouseCursor,
    visualDensity: visualDensity,
    tapTargetSize: tapTargetSize,
    animationDuration: animationDuration,
    enableFeedback: enableFeedback,
    alignment: alignment,
    splashFactory: splashFactory,
  );
}