drawTop method

void drawTop(
  1. Canvas canvas,
  2. Size size,
  3. Paint paint
)

Implementation

void drawTop(Canvas canvas, Size size, Paint paint) {
  RRect rect = RRect.fromLTRBR(
      0, arrowSize!, size.width + elevation!, size.height, radius!);
  Path path = Path()..addRRect(rect.shift(Offset(-elevation! / 2, 0)));
  canvas.drawShadow(path, Colors.grey.shade50, elevation!, true);
  canvas.drawRRect(
    RRect.fromLTRBR(0, arrowSize!, size.width, size.height, radius!),
    paint,
  );

  double offset = arrowSize! + DEFAULT_OFFSET + arrowOffset!;
  if (arrowAlignment == ArrowAlignment.center) {
    offset = size.width / 2 + arrowOffset!;
  }
  if (arrowAlignment == ArrowAlignment.end) {
    offset = size.width - arrowSize! - DEFAULT_OFFSET - arrowOffset!;
  }

  path = Path()
    ..moveTo(offset, 0)
    ..lineTo(offset - arrowSize! / 3 * 2, arrowSize!)
    ..lineTo(offset + arrowSize! / 3 * 2, arrowSize!);
  canvas.drawPath(path, paint);
}