I need to DRAW a custom marker using canvas, so far I DREW a inverse Triangle shape. Do you have any idea to about how to DRAW a marker shape?
class DrawTriangle extends CustomPainter {
Paint _paint;
DrawTriangle() {
_paint = Paint()
..color = Colors.green
..style = PaintingStyle.fill;
}
@override
void paint(Canvas canvas, Size size) {
var path = Path();
path.moveTo(size.width, size.height);
path.lineTo(size.width + 100, size.height - 100);
path.lineTo(size.width - 100, size.height - 100);
path.close();
canvas.drawPath(path, _paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
Future<Uint8List> getBytesFromCanvas(
int width, int height, Color color) async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
CustomPainter painter = DrawTriangle();
painter.paint(canvas, Size(100.0,100.0));
final img = await pictureRecorder.endRecording().toImage(width, height);
final data = await img.toByteData(format: ImageByteFormat.png);
return data.buffer.asUint8List();
}
This above method creates inverse triangle and I need to create a marker shape.. How do I achieve this?