paint method
Implementation
Future<Uint8List?> paint() async{
final recorder = PictureRecorder();
final canvas = Canvas(
recorder,
Rect.fromPoints(Offset(0.0, 0.0), Offset(200.0, 200.0)));
final background = new Paint()
..color = NUIColors.NUITransparent
..style = PaintingStyle.fill;
//Draw transparent background
canvas.drawRect(Rect.fromLTWH(0.0, 0.0, 60.0, 60.0), background);
drawCircleShadow(canvas);
final circlePaint = Paint()
..color = NUIColors.NUIWhite
..style = PaintingStyle.fill;
//Draw a circle at the center
canvas.drawCircle(Offset(30, 30,), 20.0, circlePaint);
final imagePaint = Paint()
..color = NUIColors.NUIWhite
..style = PaintingStyle.fill;
final Size imageSize = Size(56, 56);
final FittedSizes sizes = applyBoxFit(BoxFit.cover, imageSize, Size(56, 56));
final Rect inputSubrect = Alignment.center.inscribe(sizes.source, Offset.zero & imageSize);
final Rect outputSubrect = Alignment.center.inscribe(sizes.destination, Rect.fromCircle(center: Offset(30, 30), radius: 28));
if(imageBytes != null) {
canvas.drawImageRect(
await imageFromUint8List(imageBytes), inputSubrect, outputSubrect,
imagePaint);
}
final picture = recorder.endRecording();
final img = await picture.toImage(60, 60);
final pngBytes = await img.toByteData(format: ImageByteFormat.png);
return pngBytes?.buffer.asUint8List();
}