BackgroundStyle constructor

BackgroundStyle({
  1. Color? color,
  2. Paint? paint,
  3. Color? borderColor,
  4. double? borderRadius,
  5. double? borderWidth,
})

Implementation

BackgroundStyle({
  Color? color,
  Paint? paint,
  Color? borderColor,
  double? borderRadius,
  double? borderWidth,
})  : assert(
        paint == null || color == null,
        'Parameters `paint` and `color` are exclusive',
      ),
      borderWidths = EdgeInsets.all(borderWidth ?? 0),
      borderRadius = borderRadius ?? 0,
      backgroundPaint =
          paint ?? (color != null ? (Paint()..color = color) : null),
      borderPaint = borderColor != null
          ? (Paint()
            ..color = borderColor
            ..style = PaintingStyle.stroke
            ..strokeWidth = borderWidth ?? 0)
          : null;