drawBg method

  1. @override
void drawBg(
  1. Canvas canvas,
  2. Size size
)
override

Implementation

@override
void drawBg(Canvas canvas, Size size) {
  Paint mBgPaint = Paint();
  Gradient mBgGradient = LinearGradient(
    begin: Alignment.bottomCenter,
    end: Alignment.topCenter,
    colors: chartColors.bgColor,
  );
  Rect mainRect =
      Rect.fromLTRB(0, 0, mMainRect.width, mMainRect.height + mTopPadding);
  canvas.drawRect(
      mainRect, mBgPaint..shader = mBgGradient.createShader(mainRect));

  if (mVolRect != null) {
    Rect volRect = Rect.fromLTRB(
        0, mVolRect!.top - mChildPadding, mVolRect!.width, mVolRect!.bottom);
    canvas.drawRect(
        volRect, mBgPaint..shader = mBgGradient.createShader(volRect));
  }

  if (mSecondaryRect != null) {
    Rect secondaryRect = Rect.fromLTRB(0, mSecondaryRect!.top - mChildPadding,
        mSecondaryRect!.width, mSecondaryRect!.bottom);
    canvas.drawRect(secondaryRect,
        mBgPaint..shader = mBgGradient.createShader(secondaryRect));
  }
  Rect dateRect =
      Rect.fromLTRB(0, size.height - mBottomPadding, size.width, size.height);
  canvas.drawRect(
      dateRect, mBgPaint..shader = mBgGradient.createShader(dateRect));
}