paint method
Called whenever the object needs to paint. The given Canvas has its
coordinate space configured such that the origin is at the top left of the
box. The area of the box is the size of the size argument.
Paint operations should remain inside the given area. Graphical operations outside the bounds may be silently ignored, clipped, or not clipped. It may sometimes be difficult to guarantee that a certain operation is inside the bounds (e.g., drawing a rectangle whose size is determined by user inputs). In that case, consider calling Canvas.clipRect at the beginning of paint so everything that follows will be guaranteed to only draw within the clipped area.
Implementations should be wary of correctly pairing any calls to Canvas.save/Canvas.saveLayer and Canvas.restore, otherwise all subsequent painting on this canvas may be affected, with potentially hilarious but confusing results.
To paint text on a Canvas, use a TextPainter.
To paint an image on a Canvas:
-
Obtain an
ImageStream, for example by callingImageProvider.resolveon anAssetImageorNetworkImageobject. -
Whenever the
ImageStream's underlyingImageInfoobject changes (seeImageStream.addListener), create a new instance of your custom paint delegate, giving it the newImageInfoobject. -
In your delegate's paint method, call the Canvas.drawImage, Canvas.drawImageRect, or Canvas.drawImageNine methods to paint the
ImageInfo.imageobject, applying theImageInfo.scalevalue to obtain the correct rendering size.
Implementation
@override
void paint(Canvas canvas, Size size) {
Path path0 = Path();
path0.moveTo(size.width * 0.3365981, size.height * 0.2379781);
path0.lineTo(size.width * 0.3365981, size.height * 0.7479935);
path0.lineTo(size.width * 0.3045679, size.height * 0.7479935);
path0.lineTo(size.width * 0.3045679, size.height * 0.1841135);
path0.lineTo(size.width * 0.3211906, size.height * 0.1841135);
path0.cubicTo(
size.width * 0.3296340,
size.height * 0.1841135,
size.width * 0.3365981,
size.height * 0.2090087,
size.width * 0.3365981,
size.height * 0.2379781);
path0.close();
Paint paint0Fill = Paint()..style = PaintingStyle.fill;
paint0Fill.color = color ?? Colors.white;
canvas.drawPath(path0, paint0Fill);
Path path1 = Path();
path1.moveTo(size.width * 0.3760896, size.height * 0.1841135);
path1.cubicTo(
size.width * 0.3866679,
size.height * 0.1841135,
size.width * 0.3917274,
size.height * 0.2023323,
size.width * 0.3914972,
size.height * 0.2379781);
path1.lineTo(size.width * 0.3914972, size.height * 0.2703419);
path1.lineTo(size.width * 0.3594670, size.height * 0.2703419);
path1.lineTo(size.width * 0.3594670, size.height * 0.1841135);
path1.lineTo(size.width * 0.3760896, size.height * 0.1841135);
path1.close();
path1.moveTo(size.width * 0.3760896, size.height * 0.3092690);
path1.cubicTo(
size.width * 0.3864387,
size.height * 0.3092690,
size.width * 0.3914972,
size.height * 0.3266968,
size.width * 0.3914972,
size.height * 0.3623419);
path1.lineTo(size.width * 0.3914972, size.height * 0.7479935);
path1.lineTo(size.width * 0.3594670, size.height * 0.7479935);
path1.lineTo(size.width * 0.3594670, size.height * 0.3092690);
path1.lineTo(size.width * 0.3760896, size.height * 0.3092690);
path1.close();
Paint paint1Fill = Paint()..style = PaintingStyle.fill;
paint1Fill.color = color ?? Colors.white;
canvas.drawPath(path1, paint1Fill);
Path path2 = Path();
path2.moveTo(size.width * 0.4415604, size.height * 0.3706032);
path2.cubicTo(
size.width * 0.4497406,
size.height * 0.3250000,
size.width * 0.4617642,
size.height * 0.3025926,
size.width * 0.4776642,
size.height * 0.3025926);
path2.cubicTo(
size.width * 0.5116000,
size.height * 0.3067797,
size.width * 0.5284528,
size.height * 0.3830484,
size.width * 0.5284528,
size.height * 0.5323097);
path2.cubicTo(
size.width * 0.5284528,
size.height * 0.6782871,
size.width * 0.5087085,
size.height * 0.7520677,
size.width * 0.4692208,
size.height * 0.7545548);
path2.cubicTo(
size.width * 0.4295038,
size.height * 0.7553484,
size.width * 0.4095302,
size.height * 0.6898290,
size.width * 0.4095302,
size.height * 0.5579968);
path2.lineTo(size.width * 0.4095302, size.height * 0.1841135);
path2.lineTo(size.width * 0.4256594, size.height * 0.1841135);
path2.cubicTo(
size.width * 0.4362377,
size.height * 0.1841135,
size.width * 0.4415604,
size.height * 0.2032377,
size.width * 0.4415604,
size.height * 0.2396755);
path2.lineTo(size.width * 0.4415604, size.height * 0.3706032);
path2.close();
path2.moveTo(size.width * 0.4415604, size.height * 0.5273290);
path2.cubicTo(
size.width * 0.4413302,
size.height * 0.6160484,
size.width * 0.4499698,
size.height * 0.6608581,
size.width * 0.4682689,
size.height * 0.6608581);
path2.cubicTo(
size.width * 0.4865670,
size.height * 0.6608581,
size.width * 0.4957000,
size.height * 0.6160484,
size.width * 0.4957000,
size.height * 0.5273290);
path2.cubicTo(
size.width * 0.4949764,
size.height * 0.4428000,
size.width * 0.4860736,
size.height * 0.4012677,
size.width * 0.4687283,
size.height * 0.4012677);
path2.cubicTo(
size.width * 0.4514151,
size.height * 0.4013806,
size.width * 0.4425132,
size.height * 0.4428000,
size.width * 0.4415604,
size.height * 0.5273290);
path2.close();
Paint paint2Fill = Paint()..style = PaintingStyle.fill;
paint2Fill.color = color ?? Colors.white;
canvas.drawPath(path2, paint2Fill);
Path path3 = Path();
path3.moveTo(size.width * 0.5997047, size.height * 0.7579484);
path3.cubicTo(
size.width * 0.5612028,
size.height * 0.7537613,
size.width * 0.5419189,
size.height * 0.6767000,
size.width * 0.5419189,
size.height * 0.5274387);
path3.cubicTo(
size.width * 0.5419189,
size.height * 0.3781806,
size.width * 0.5614321,
size.height * 0.3034948,
size.width * 0.6001642,
size.height * 0.3027029);
path3.cubicTo(
size.width * 0.6406047,
size.height * 0.3027029,
size.width * 0.6596255,
size.height * 0.3881387,
size.width * 0.6572274,
size.height * 0.5598032);
path3.lineTo(size.width * 0.5749019, size.height * 0.5598032);
path3.cubicTo(
size.width * 0.5761170,
size.height * 0.6270226,
size.width * 0.5845274,
size.height * 0.6609677,
size.width * 0.6001642,
size.height * 0.6609677);
path3.cubicTo(
size.width * 0.6076217,
size.height * 0.6609677,
size.width * 0.6146189,
size.height * 0.6502194,
size.width * 0.6208613,
size.height * 0.6293968);
path3.cubicTo(
size.width * 0.6237519,
size.height * 0.6186484,
size.width * 0.6273651,
size.height * 0.6136677,
size.width * 0.6317019,
size.height * 0.6136677);
path3.lineTo(size.width * 0.6552896, size.height * 0.6136677);
path3.cubicTo(
size.width * 0.6483245,
size.height * 0.7064613,
size.width * 0.6310123,
size.height * 0.7579484,
size.width * 0.5997047,
size.height * 0.7579484);
path3.close();
path3.moveTo(size.width * 0.5753943, size.height * 0.4809323);
path3.lineTo(size.width * 0.6232915, size.height * 0.4809323);
path3.cubicTo(
size.width * 0.6213538,
size.height * 0.4228806,
size.width * 0.6134368,
size.height * 0.3930065,
size.width * 0.5997047,
size.height * 0.3930065);
path3.cubicTo(
size.width * 0.5859726,
size.height * 0.3930065,
size.width * 0.5777925,
size.height * 0.4228806,
size.width * 0.5753943,
size.height * 0.4809323);
path3.close();
Paint paint3Fill = Paint()..style = PaintingStyle.fill;
paint3Fill.color = color ?? Colors.white;
canvas.drawPath(path3, paint3Fill);
Path path4 = Path();
path4.moveTo(size.width * 0.7041726, size.height * 0.2379781);
path4.lineTo(size.width * 0.7041726, size.height * 0.7479935);
path4.lineTo(size.width * 0.6721425, size.height * 0.7479935);
path4.lineTo(size.width * 0.6721425, size.height * 0.1841135);
path4.lineTo(size.width * 0.6887651, size.height * 0.1841135);
path4.cubicTo(
size.width * 0.6972075,
size.height * 0.1841135,
size.width * 0.7041726,
size.height * 0.2090087,
size.width * 0.7041726,
size.height * 0.2379781);
path4.close();
Paint paint4Fill = Paint()..style = PaintingStyle.fill;
paint4Fill.color = color ?? Colors.white;
canvas.drawPath(path4, paint4Fill);
Path path5 = Path();
path5.moveTo(size.width * 0.8293434, size.height * 0.5729355);
path5.cubicTo(
size.width * 0.8293434,
size.height * 0.6484129,
size.width * 0.8237915,
size.height * 0.6982032,
size.width * 0.8124906,
size.height * 0.7221935);
path5.cubicTo(
size.width * 0.8011896,
size.height * 0.7446000,
size.width * 0.7886726,
size.height * 0.7562548,
size.width * 0.7749406,
size.height * 0.7562548);
path5.cubicTo(
size.width * 0.7617019,
size.height * 0.7562548,
size.width * 0.7499075,
size.height * 0.7438065,
size.width * 0.7388368,
size.height * 0.7189129);
path5.cubicTo(
size.width * 0.7277660,
size.height * 0.6949226,
size.width * 0.7222142,
size.height * 0.6467161,
size.width * 0.7222142,
size.height * 0.5729355);
path5.lineTo(size.width * 0.7222142, size.height * 0.3092710);
path5.lineTo(size.width * 0.7542443, size.height * 0.3092710);
path5.lineTo(size.width * 0.7542443, size.height * 0.5953419);
path5.cubicTo(
size.width * 0.7542443,
size.height * 0.6442258,
size.width * 0.7614717,
size.height * 0.6683290,
size.width * 0.7759264,
size.height * 0.6683290);
path5.cubicTo(
size.width * 0.7903811,
size.height * 0.6683290,
size.width * 0.7976085,
size.height * 0.6443387,
size.width * 0.7976085,
size.height * 0.5953419);
path5.lineTo(size.width * 0.7976085, size.height * 0.3640419);
path5.cubicTo(
size.width * 0.7973783,
size.height * 0.3276032,
size.width * 0.8024047,
size.height * 0.3092710,
size.width * 0.8130160,
size.height * 0.3092710);
path5.lineTo(size.width * 0.8293764, size.height * 0.3092710);
path5.lineTo(size.width * 0.8293764, size.height * 0.5729355);
path5.lineTo(size.width * 0.8293434, size.height * 0.5729355);
path5.close();
Paint paint5Fill = Paint()..style = PaintingStyle.fill;
paint5Fill.color = color ?? Colors.white;
canvas.drawPath(path5, paint5Fill);
Path path6 = Path();
path6.moveTo(size.width * 0.8753292, size.height * 0.2379781);
path6.lineTo(size.width * 0.8753292, size.height * 0.7479935);
path6.lineTo(size.width * 0.8432981, size.height * 0.7479935);
path6.lineTo(size.width * 0.8432981, size.height * 0.1841135);
path6.lineTo(size.width * 0.8599217, size.height * 0.1841135);
path6.cubicTo(
size.width * 0.8683311,
size.height * 0.1841135,
size.width * 0.8753292,
size.height * 0.2090087,
size.width * 0.8753292,
size.height * 0.2379781);
path6.close();
Paint paint6Fill = Paint()..style = PaintingStyle.fill;
paint6Fill.color = color ?? Colors.white;
canvas.drawPath(path6, paint6Fill);
Path path7 = Path();
path7.moveTo(size.width * 0.9263519, size.height * 0.4237839);
path7.lineTo(size.width * 0.8943208, size.height * 0.4237839);
path7.cubicTo(
size.width * 0.8981651,
size.height * 0.3425355,
size.width * 0.9147877,
size.height * 0.3027029,
size.width * 0.9441604,
size.height * 0.3027029);
path7.cubicTo(
size.width * 0.9793113,
size.height * 0.3027029,
size.width * 0.9971132,
size.height * 0.3425355,
size.width * 0.9978396,
size.height * 0.4237839);
path7.lineTo(size.width * 0.9978396, size.height * 0.5730419);
path7.cubicTo(
size.width * 0.9978396,
size.height * 0.6941258,
size.width * 0.9766509,
size.height * 0.7479903,
size.width * 0.9422189,
size.height * 0.7562516);
path7.cubicTo(
size.width * 0.9116340,
size.height * 0.7645097,
size.width * 0.8904774,
size.height * 0.7156258,
size.width * 0.8904774,
size.height * 0.6186484);
path7.cubicTo(
size.width * 0.8912000,
size.height * 0.5132935,
size.width * 0.9133425,
size.height * 0.4851161,
size.width * 0.9456038,
size.height * 0.4743677);
path7.cubicTo(
size.width * 0.9593302,
size.height * 0.4685968,
size.width * 0.9663019,
size.height * 0.4544516,
size.width * 0.9663019,
size.height * 0.4304613);
path7.cubicTo(
size.width * 0.9655755,
size.height * 0.4055645,
size.width * 0.9588396,
size.height * 0.3931194,
size.width * 0.9456038,
size.height * 0.3931194);
path7.cubicTo(
size.width * 0.9343019,
size.height * 0.3930065,
size.width * 0.9280594,
size.height * 0.4029645,
size.width * 0.9263519,
size.height * 0.4237839);
path7.close();
path7.moveTo(size.width * 0.9667925, size.height * 0.5680645);
path7.lineTo(size.width * 0.9667925, size.height * 0.5274387);
path7.cubicTo(
size.width * 0.9593302,
size.height * 0.5381903,
size.width * 0.9506604,
size.height * 0.5473548,
size.width * 0.9412660,
size.height * 0.5539194);
path7.cubicTo(
size.width * 0.9285198,
size.height * 0.5621806,
size.width * 0.9220151,
size.height * 0.5828871,
size.width * 0.9220151,
size.height * 0.6152516);
path7.cubicTo(
size.width * 0.9227377,
size.height * 0.6501065,
size.width * 0.9280274,
size.height * 0.6666258,
size.width * 0.9381453,
size.height * 0.6666258);
path7.cubicTo(
size.width * 0.9559811,
size.height * 0.6667419,
size.width * 0.9667925,
size.height * 0.6301903,
size.width * 0.9667925,
size.height * 0.5680645);
path7.close();
Paint paint7Fill = Paint()..style = PaintingStyle.fill;
paint7Fill.color = color ?? Colors.white;
canvas.drawPath(path7, paint7Fill);
Path path8 = Path();
path8.moveTo(size.width * 0.6014453, size.height * 0.1928239);
path8.cubicTo(
size.width * 0.6120236,
size.height * 0.1928239,
size.width * 0.6170830,
size.height * 0.2110426,
size.width * 0.6168528,
size.height * 0.2466884);
path8.lineTo(size.width * 0.6168528, size.height * 0.2790523);
path8.lineTo(size.width * 0.5848226, size.height * 0.2790523);
path8.lineTo(size.width * 0.5848226, size.height * 0.1928239);
path8.lineTo(size.width * 0.6014453, size.height * 0.1928239);
path8.close();
Paint paint8Fill = Paint()..style = PaintingStyle.fill;
paint8Fill.color = color ?? Colors.white;
canvas.drawPath(path8, paint8Fill);
Path path9 = Path();
path9.moveTo(size.width * 0.1316396, size.height * 0.3407323);
path9.cubicTo(
size.width * 0.1484594,
size.height * 0.3407323,
size.width * 0.1621585,
size.height * 0.2935458,
size.width * 0.1621585,
size.height * 0.2356074);
path9.cubicTo(
size.width * 0.1621585,
size.height * 0.1776694,
size.width * 0.1484594,
size.height * 0.1304813,
size.width * 0.1316396,
size.height * 0.1304813);
path9.cubicTo(
size.width * 0.1148198,
size.height * 0.1304813,
size.width * 0.1011208,
size.height * 0.1776694,
size.width * 0.1011208,
size.height * 0.2356074);
path9.cubicTo(
size.width * 0.1011208,
size.height * 0.2935458,
size.width * 0.1148198,
size.height * 0.3407323,
size.width * 0.1316396,
size.height * 0.3407323);
path9.close();
path9.moveTo(size.width * 0.1316396, size.height * 0.1957748);
path9.cubicTo(
size.width * 0.1380123,
size.height * 0.1957748,
size.width * 0.1432028,
size.height * 0.2136545,
size.width * 0.1432028,
size.height * 0.2356074);
path9.cubicTo(
size.width * 0.1432028,
size.height * 0.2575606,
size.width * 0.1380123,
size.height * 0.2754400,
size.width * 0.1316396,
size.height * 0.2754400);
path9.cubicTo(
size.width * 0.1252660,
size.height * 0.2754400,
size.width * 0.1200755,
size.height * 0.2575606,
size.width * 0.1200755,
size.height * 0.2356074);
path9.cubicTo(
size.width * 0.1200755,
size.height * 0.2136545,
size.width * 0.1252660,
size.height * 0.1957748,
size.width * 0.1316396,
size.height * 0.1957748);
path9.close();
Paint paint9Fill = Paint()..style = PaintingStyle.fill;
paint9Fill.color = color ?? Colors.white;
canvas.drawPath(path9, paint9Fill);
Path path10 = Path();
path10.moveTo(size.width * 0.2630453, size.height * 0.4327226);
path10.cubicTo(
size.width * 0.2630453,
size.height * 0.4306871,
size.width * 0.2629792,
size.height * 0.4287613,
size.width * 0.2628802,
size.height * 0.4268387);
path10.lineTo(size.width * 0.2628802, size.height * 0.3199019);
path10.cubicTo(
size.width * 0.2628802,
size.height * 0.2728271,
size.width * 0.2555547,
size.height * 0.2286945,
size.width * 0.2437613,
size.height * 0.2048174);
path10.lineTo(size.width * 0.1515792, size.height * 0.01832890);
path10.cubicTo(
size.width * 0.1395226,
size.height * -0.006113774,
size.width * 0.1245094,
size.height * -0.006113774,
size.width * 0.1124528,
size.height * 0.01810258);
path10.lineTo(size.width * 0.02135557, size.height * 0.2013097);
path10.cubicTo(
size.width * 0.009496132,
size.height * 0.2251865,
size.width * 0.002137377,
size.height * 0.2693190,
size.width * 0.002137377,
size.height * 0.3165071);
path10.lineTo(size.width * 0.002137377, size.height * 0.6877871);
path10.cubicTo(
size.width * 0.002137377,
size.height * 0.7353129,
size.width * 0.009561887,
size.height * 0.7796742,
size.width * 0.02155264,
size.height * 0.8034355);
path10.lineTo(size.width * 0.1116972, size.height * 0.9822323);
path10.cubicTo(
size.width * 0.1176434,
size.height * 0.9941129,
size.width * 0.1243453,
size.height * 0.9999968,
size.width * 0.1310142,
size.height * 0.9999968);
path10.cubicTo(
size.width * 0.1376830,
size.height * 0.9999968,
size.width * 0.1443519,
size.height * 0.9941129,
size.width * 0.1502981,
size.height * 0.9823452);
path10.lineTo(size.width * 0.2434321, size.height * 0.7982323);
path10.cubicTo(
size.width * 0.2554236,
size.height * 0.7744677,
size.width * 0.2628802,
size.height * 0.7302226,
size.width * 0.2628802,
size.height * 0.6824677);
path10.lineTo(size.width * 0.2628802, size.height * 0.4386065);
path10.cubicTo(
size.width * 0.2629792,
size.height * 0.4366839,
size.width * 0.2630453,
size.height * 0.4347613,
size.width * 0.2630453,
size.height * 0.4327226);
path10.close();
path10.moveTo(size.width * 0.07033736, size.height * 0.3963968);
path10.lineTo(size.width * 0.02319528, size.height * 0.3963968);
path10.lineTo(size.width * 0.02319528, size.height * 0.3374419);
path10.lineTo(size.width * 0.07033736, size.height * 0.3963968);
path10.close();
path10.moveTo(size.width * 0.2418226, size.height * 0.3343871);
path10.lineTo(size.width * 0.2418226, size.height * 0.3963968);
path10.lineTo(size.width * 0.1921509, size.height * 0.3963968);
path10.lineTo(size.width * 0.2418226, size.height * 0.3343871);
path10.close();
path10.moveTo(size.width * 0.02319528, size.height * 0.4689355);
path10.lineTo(size.width * 0.07234123, size.height * 0.4689355);
path10.lineTo(size.width * 0.02319528, size.height * 0.5303806);
path10.lineTo(size.width * 0.02319528, size.height * 0.4689355);
path10.close();
path10.moveTo(size.width * 0.2418226, size.height * 0.4689355);
path10.lineTo(size.width * 0.2418226, size.height * 0.5335484);
path10.lineTo(size.width * 0.1901472, size.height * 0.4689355);
path10.lineTo(size.width * 0.2418226, size.height * 0.4689355);
path10.close();
path10.moveTo(size.width * 0.1230642, size.height * 0.08079355);
path10.cubicTo(
size.width * 0.1258236,
size.height * 0.07524871,
size.width * 0.1288792,
size.height * 0.07253290,
size.width * 0.1319670,
size.height * 0.07253290);
path10.cubicTo(
size.width * 0.1350547,
size.height * 0.07253290,
size.width * 0.1381434,
size.height * 0.07536194,
size.width * 0.1409028,
size.height * 0.08090677);
path10.lineTo(size.width * 0.2330840, size.height * 0.2673952);
path10.cubicTo(
size.width * 0.2331500,
size.height * 0.2675084,
size.width * 0.2332160,
size.height * 0.2677348,
size.width * 0.2332811,
size.height * 0.2678481);
path10.lineTo(size.width * 0.1312443, size.height * 0.3953806);
path10.lineTo(size.width * 0.02992981, size.height * 0.2687532);
path10.cubicTo(
size.width * 0.03055406,
size.height * 0.2670558,
size.width * 0.03124387,
size.height * 0.2653584,
size.width * 0.03196660,
size.height * 0.2638874);
path10.lineTo(size.width * 0.1230642, size.height * 0.08079355);
path10.close();
path10.moveTo(size.width * 0.03206519, size.height * 0.7405194);
path10.cubicTo(
size.width * 0.02661179,
size.height * 0.7296548,
size.width * 0.02322811,
size.height * 0.7095129,
size.width * 0.02322811,
size.height * 0.6877871);
path10.lineTo(size.width * 0.02322811, size.height * 0.6075548);
path10.lineTo(size.width * 0.1213887, size.height * 0.4848903);
path10.lineTo(size.width * 0.1213887, size.height * 0.9177290);
path10.lineTo(size.width * 0.03206519, size.height * 0.7405194);
path10.close();
path10.moveTo(size.width * 0.2329528, size.height * 0.7353129);
path10.lineTo(size.width * 0.1424142, size.height * 0.9143355);
path10.lineTo(size.width * 0.1424142, size.height * 0.4865871);
path10.lineTo(size.width * 0.2418226, size.height * 0.6108387);
path10.lineTo(size.width * 0.2418226, size.height * 0.6826935);
path10.cubicTo(
size.width * 0.2418226,
size.height * 0.7043097,
size.width * 0.2384387,
size.height * 0.7244516,
size.width * 0.2329528,
size.height * 0.7353129);
path10.close();
Paint paint10Fill = Paint()..style = PaintingStyle.fill;
paint10Fill.color = color ?? Colors.white;
canvas.drawPath(path10, paint10Fill);
}