{"id":367883,"date":"2024-05-21T03:30:47","date_gmt":"2024-05-21T03:30:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=367883"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=367883","title":{"rendered":"<span>\u0420\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0430 SVG \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u043e flutter, \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c Impeller<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c, \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/791886\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043a\u0435\u0439\u0441\u0435.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e2\/c5f\/1e0\/3e2c5f1e0a95c27d9af305c4b30b7c9d.gif\" width=\"296\" height=\"296\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e2\/c5f\/1e0\/3e2c5f1e0a95c27d9af305c4b30b7c9d.gif\"\/><\/figure>\n<hr\/>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0438<\/h2>\n<p>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u043e url<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0446\u0432\u0435\u0442<\/p>\n<\/li>\n<\/ol>\n<h4>\u041f\u0440\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430. <\/p>\n<p>SVG (Scalable Vector Graphics) \u2014 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e XML-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432. \u0412\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SVG \u0445\u043e\u0440\u043e\u0448\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a JPEG \u0438\u043b\u0438 PNG, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0445\u0443\u0434\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8a0\/04b\/54d\/8a004b54d213b4be227a6842910a71bb.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 svg\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 svg\" width=\"412\" height=\"390\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a0\/04b\/54d\/8a004b54d213b4be227a6842910a71bb.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 svg<\/figcaption><\/div>\n<\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 SVG, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432\u044b\u0448\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;svg width=\"200\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">   &lt;!-- \u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u0433\u043b\u0430\u043c\u0438 -->   &lt;rect x=\"10\" y=\"10\" width=\"50\" height=\"50\" rx=\"10\" ry=\"10\" fill=\"red\" stroke=\"black\" stroke-width=\"2\"\/>    &lt;!-- \u0421\u0438\u043d\u0438\u0439 \u043a\u0440\u0443\u0433 -->   &lt;circle cx=\"100\" cy=\"50\" r=\"20\" fill=\"blue\" stroke=\"green\" stroke-width=\"3\"\/>    &lt;!-- \u0416\u0435\u043b\u0442\u044b\u0439 \u044d\u043b\u043b\u0438\u043f\u0441 -->   &lt;ellipse cx=\"160\" cy=\"50\" rx=\"20\" ry=\"10\" fill=\"yellow\" stroke=\"pink\" stroke-width=\"2\"\/>    &lt;!-- \u0427\u0435\u0440\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f -->   &lt;line x1=\"10\" y1=\"100\" x2=\"50\" y2=\"150\" stroke=\"black\" stroke-width=\"4\"\/>    &lt;!-- \u041f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u044f (\u043b\u043e\u043c\u0430\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f) -->   &lt;polyline points=\"60 100, 90 120, 120 100, 150 120\" stroke=\"orange\" stroke-width=\"2\" fill=\"none\"\/>    &lt;!-- \u041c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (\u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u0430) -->   &lt;polygon points=\"160 100, 190 120, 160 140, 130 120\" stroke=\"purple\" fill=\"lime\" stroke-width=\"1\"\/>    &lt;!-- \u041f\u0443\u0442\u044c (\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u0430) -->   &lt;path d=\"M10 160 Q 50 200, 90 160 T 170 160\" fill=\"none\" stroke=\"brown\" stroke-width=\"2\"\/> &lt;\/svg> <\/code><\/pre>\n<ol>\n<li>\n<p><strong>XML-\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435<\/strong>: \u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f XML-\u0444\u0430\u0439\u043b\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?><\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>SVG \u0442\u0435\u0433<\/strong>: \u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>&lt;svg width=\"200\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><\/code>. \u0418\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043e \u0442\u0430\u043a<code>viewBox=\"0 0 200 200\"<\/code>. <\/p>\n<\/li>\n<li>\n<p><strong>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/strong>: \u0412\u043d\u0443\u0442\u0440\u0438 SVG \u0442\u0435\u0433\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b (\u043b\u0438\u043d\u0438\u0438, \u043a\u0440\u0443\u0433\u0438, \u044d\u043b\u043b\u0438\u043f\u0441\u044b, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438 \u0442.\u0434.): \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>&lt;rect x=\"10\" y=\"10\" width=\"50\" height=\"50\" rx=\"10\" ry=\"10\"\/><\/code> \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0443\u0442\u0438 (<code>&lt;path><\/code>): \u0421\u0430\u043c\u044b\u0439 \u043c\u043e\u0449\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 SVG, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0438 \u043a\u0440\u0438\u0432\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043a\u0441\u0442 (<code>&lt;text><\/code>): \u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0443\u043f\u043f\u044b (<code>&lt;g><\/code>): \u0414\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SVG.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b<\/strong>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0440\u0430\u0437\u043c\u0435\u0440\u044b, \u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u043b\u0438\u0432\u043a\u0438,  \u043e\u0431\u0432\u043e\u0434\u043a\u0438, \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>fill=\"red\"<\/code> \u0437\u0430\u0434\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438.<\/p>\n<p>\u0418 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435. \u041d\u0430 \u043d\u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043e\u0441\u0442\u0440\u044f\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0430\u043f\u0438 Canvas \u0432\u043e flutter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 CustomPaint.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u043a\u0435\u0439\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044b\u0435 path.<\/p>\n<p><strong>\u0428\u0430\u0433\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u00a0\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430: <code>VectorImage<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438 \u0435\u0451 \u0440\u0430\u0437\u043c\u0435\u0440, <code>PathSvgItem<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c <code>Path path<\/code> \u0438 \u0446\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438 <code>Color? fill<\/code> <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ models.dart  import 'dart:ui';  class VectorImage {   const VectorImage({     required this.items,     this.size,   });    final List&lt;PathSvgItem> items;   final Size? size; }  class PathSvgItem {   const PathSvgItem({     required this.path,     this.fill,   });    final Path path;   final Color? fill; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c <code>CustomPainter<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ svg_painter.dart  import 'package:flutter\/material.dart';  import 'models.dart';  class SvgPainter extends CustomPainter {   const SvgPainter(this.pathSvgItem);   final PathSvgItem pathSvgItem;    @override   void paint(Canvas canvas, Size size) {     Path path = pathSvgItem.path;      final paint = Paint();     paint.color = pathSvgItem.fill ?? Colors.white;     paint.style = PaintingStyle.fill;      canvas.drawPath(path, paint);   }    @override   bool shouldRepaint(SvgPainter oldDelegate) => false; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 SVG \u0444\u0430\u0439\u043b\u0430 \u043f\u043e \u0443\u0440\u043b \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ utils.dart  import 'package:http\/http.dart' as http;  Future&lt;String> getSvgData(String url) async {   final http.Response data = await http.get(Uri.parse(url));   return data.body; }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 SVG \u0444\u0430\u0439\u043b\u0430.<\/strong> \u0417\u043d\u0430\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 SVG \u0444\u0430\u0439\u043b\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/pub.dev\/packages\/xml\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f XML \u0444\u0430\u0439\u043b\u043e\u0432<\/a>, \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ utils.dart  import 'package:flutter\/material.dart'; import 'package:path_drawing\/path_drawing.dart'; import 'package:xml\/xml.dart';  import 'models.dart';  VectorImage getVectorImageFromStringXml(String svgData) {   List&lt;PathSvgItem> items = [];    \/\/ step 1: parse the xml   XmlDocument document = XmlDocument.parse(svgData);    \/\/ step 2: get the size of the svg   Size? size;   String? width = document.findAllElements('svg').first.getAttribute('width');   String? height = document.findAllElements('svg').first.getAttribute('height');   String? viewBox = document.findAllElements('svg').first.getAttribute('viewBox');   if (width != null &amp;&amp; height != null) {     width = width.replaceAll(RegExp(r'[^0-9.]'), '');     height = height.replaceAll(RegExp(r'[^0-9.]'), '');     size = Size(double.parse(width), double.parse(height));   } else if (viewBox != null) {     List&lt;String> viewBoxList = viewBox.split(' ');     size = Size(double.parse(viewBoxList[2]), double.parse(viewBoxList[3]));   }    \/\/ step 3: get the paths   final List&lt;XmlElement> paths = document.findAllElements('path').toList();   for (int i = 0; i &lt; paths.length; i++) {     final XmlElement element = paths[i];      \/\/ get the path     String? pathString = element.getAttribute('d');     if (pathString == null) {       continue;     }     Path path = parseSvgPathData(pathString);      \/\/ get the fill color     String? fill = element.getAttribute('fill');     String? style = element.getAttribute('style');     if (style != null) {       fill = _getFillColor(style);     }      \/\/ get the transformations     String? transformAttribute = element.getAttribute('transform');     double scaleX = 1.0;     double scaleY = 1.0;     double? translateX;     double? translateY;     if (transformAttribute != null) {       ({double x, double y})? scale = _getScale(transformAttribute);       if (scale != null) {         scaleX = scale.x;         scaleY = scale.y;       }       ({double x, double y})? translate = _getTranslate(transformAttribute);       if (translate != null) {         translateX = translate.x;         translateY = translate.y;       }     }      final Matrix4 matrix4 = Matrix4.identity();     if (translateX != null &amp;&amp; translateY != null) {       matrix4.translate(translateX, translateY);     }     matrix4.scale(scaleX, scaleY);      path = path.transform(matrix4.storage);      items.add(PathSvgItem(       fill: _getColorFromString(fill),       path: path,     ));   }    return VectorImage(items: items, size: size); }  ({double x, double y})? _getScale(String data) {   RegExp regExp = RegExp(r'scale\\(([^,]+),([^)]+)\\)');   var match = regExp.firstMatch(data);    if (match != null) {     double scaleX = double.parse(match.group(1)!);     double scaleY = double.parse(match.group(2)!);      return (x: scaleX, y: scaleY);   } else {     return null;   } }  ({double x, double y})? _getTranslate(String data) {   RegExp regExp = RegExp(r'translate\\(([^,]+),([^)]+)\\)');   var match = regExp.firstMatch(data);    if (match != null) {     double translateX = double.parse(match.group(1)!);     double translateY = double.parse(match.group(2)!);      return (x: translateX, y: translateY);   } else {     return null;   } }  String? _getFillColor(String data) {   RegExp regExp = RegExp(r'fill:\\s*(#[a-fA-F0-9]{6})');   RegExpMatch? match = regExp.firstMatch(data);    return match?.group(1); }  Color _hexToColor(String hex) {   final buffer = StringBuffer();   if (hex.length == 6 || hex.length == 7) buffer.write('ff');   buffer.write(hex.replaceFirst('#', ''));   return Color(int.parse(buffer.toString(), radix: 16)); }  Color? _getColorFromString(String? colorString) {   if (colorString == null) return null;   if (colorString.startsWith('#')) {     return _hexToColor(colorString);   } else {     switch (colorString) {       case 'red':         return Colors.red;       case 'green':         return Colors.green;       case 'blue':         return Colors.blue;       case 'yellow':         return Colors.yellow;       case 'white':         return Colors.white;       case 'black':         return Colors.black;       default:         return Colors.transparent;     }   } } <\/code><\/pre>\n<p>\u0418\u0437-\u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0445\u044d\u043b\u043f\u0435\u0440\u043e\u0432. \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043a\u0435\u0439\u0441\u044b, \u0438 \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u043c\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443. \u041d\u043e \u044f \u0442\u0430\u043a\u043e\u0439 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f ChatGPT \u0434\u043b\u044f \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430.<\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e, \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e, \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 XML \u043e\u0431\u044a\u0435\u043a\u0442, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 <code>width<\/code> \u0438 <code>height<\/code>, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 <code>viewBox<\/code><\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 path, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c. \u0414\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Path<\/code> \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/pub.dev\/packages\/path_drawing\" rel=\"noopener noreferrer nofollow\">path_drawing<\/a>: <br \/><code>Path parseSvgPathData(String svg)<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<br \/>&#8212; \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 &#171;red&#187;, &#171;blue&#187; \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 hex<br \/>&#8212; \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043b\u0438\u043d\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (0;0) \u0438 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u0443\u0447\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 <code>VectorImage<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u043a\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u0430\u043a <code>strokeWidth<\/code>, <code>strokeJoin<\/code> \u0438 \u0434\u0440<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0442\u044f\u043d\u0443\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">Future&lt;VectorImage> getVectorImage(String url) async {   final String svgData = await getSvgData(url);   final VectorImage vectorImage = getVectorImageFromStringXml(svgData);   return vectorImage; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0441\u0430\u043c \u044d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">import 'package:flutter\/material.dart'; import 'package:painter\/features\/coloring_svg\/svg_painter.dart';  import 'models.dart'; import 'utils.dart';  class ColoringSvgScreen extends StatefulWidget {   const ColoringSvgScreen({super.key});    @override   State&lt;ColoringSvgScreen> createState() => _ColoringSvgScreenState(); }  class _ColoringSvgScreenState extends State&lt;ColoringSvgScreen> {      @override   void initState() {     _init();     super.initState();   }    Size? _size;   List&lt;PathSvgItem>? _items;    static const urlDogWithSmile =       'https:\/\/vk.com\/doc223802256_674334116?hash=407AqZBhX6zQrqcI3cGxCZdJGaZDbv1ywq65EZ8eHqH&amp;dl=5KapGZXnEYzXOUUA977vWJoTB0kvZSrUzp7drp4qPIX';    Future&lt;void> _init() async {     final value = await getVectorImage(urlDogWithSmile);     setState(() {       _items = value.items;       _size = value.size;     });   }    @override   Widget build(BuildContext context) {     return Scaffold(       appBar: AppBar(title: const Text('Coloring SVG')),       body: _items == null || _size == null           ? const Center(child: CircularProgressIndicator())           : InteractiveViewer(               child: Center(                 child: FittedBox(                   \/\/ RepaintBoundary should be used to prevent rebuilds                   \/\/ during transformations with InteractiveViewer                   child: RepaintBoundary(                      child: SizedBox(                       width: _size!.width,                       height: _size!.height,                       child: Stack(                         children: [                           for (int index = 0; index &lt; _items!.length; index++)                             SvgPainterImage(                               item: _items![index],                             )                         ],                       ),                     ),                   ),                 ),               ),             ),     );   } }  class SvgPainterImage extends StatelessWidget {   const SvgPainterImage({     super.key,     required this.item,   });   final PathSvgItem item;    @override   Widget build(BuildContext context) {     return CustomPaint(       painter: SvgPainter(item),     );   } } <\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/290\/0d9\/3fc\/2900d93fcaa5c6e2c34c5fd1ad5b33b8.gif\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" width=\"296\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/290\/0d9\/3fc\/2900d93fcaa5c6e2c34c5fd1ad5b33b8.gif\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f 1 \u0438 2. <\/p>\n<p><strong>\u041a\u0430\u043a \u043e\u0442\u043b\u043e\u0432\u0438\u0442\u044c, \u043d\u0430 \u043a\u0430\u043a\u0443\u044e \u0438\u0437 \u0444\u0438\u0433\u0443\u0440 \u0442\u0430\u043f\u043d\u0443\u043b\u0438?<\/strong><\/p>\n<p>\u0412 <code>CustomPainter<\/code> \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>bool? hitTest(Offset position)<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439.  <\/p>\n<pre><code class=\"dart\">class SvgPainter extends CustomPainter {   const SvgPainter(this.pathSvgItem, this.onTap);   final PathSvgItem pathSvgItem;   final VoidCallback onTap;    @override   void paint(Canvas canvas, Size size) {     Path path = pathSvgItem.path;      final paint = Paint();     paint.color = pathSvgItem.fill ?? Colors.white;     paint.style = PaintingStyle.fill;      canvas.drawPath(path, paint);   }    @override   bool? hitTest(Offset position) {     Path path = pathSvgItem.path;     if (path.contains(position)) {       onTap();       return true;     }     return super.hitTest(position);   }    @override   bool shouldRepaint(SvgPainter oldDelegate) {     return pathSvgItem != oldDelegate.pathSvgItem;   } } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u043b\u043b\u0431\u044d\u043a <code>onTap()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435, \u0435\u0441\u043b\u0438 <code>Offset position<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0443\u0440\u0430 <code>Path path<\/code>. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <code>true<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u0445, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u043d\u0438\u0436\u0435 \u0432 \u0441\u0442\u0435\u043a\u0435, \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043c\u0435\u0442\u043e\u0434 <code>hitTest()<\/code>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <code>path.contains(position) == true<\/code> \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <code>PathSvgItem<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <code>shouldRepaint<\/code> \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 <code>ColoringSvgScreen<\/code>:<\/p>\n<pre><code class=\"dart\">class ColoringSvgScreen extends StatefulWidget {   const ColoringSvgScreen({super.key});    @override   State&lt;ColoringSvgScreen> createState() => _ColoringSvgScreenState(); }  class _ColoringSvgScreenState extends State&lt;ColoringSvgScreen> {   @override   void initState() {     _init();     super.initState();   }    Size? _size;   List&lt;PathSvgItem>? _items;    static const urlDogWithSmile =       'https:\/\/vk.com\/doc223802256_674334116?hash=407AqZBhX6zQrqcI3cGxCZdJGaZDbv1ywq65EZ8eHqH&amp;dl=5KapGZXnEYzXOUUA977vWJoTB0kvZSrUzp7drp4qPIX';    Future&lt;void> _init() async {     final value = await getVectorImage(urlDogWithSmile);     setState(() {       _items = value.items;       _size = value.size;     });   }    void _onTap(int index) {     setState(() {       _items![index] = _items![index].copyWith(         fill: Colors.red,       );     });   }    @override   Widget build(BuildContext context) {     return Scaffold(       appBar: AppBar(title: const Text('Coloring SVG')),       body: _items == null || _size == null           ? const Center(child: CircularProgressIndicator())           : InteractiveViewer(               child: Center(                 child: FittedBox(                   \/\/ RepaintBoundary should be used to prevent rebuilds                   \/\/ during transformations with InteractiveViewer                   child: RepaintBoundary(                     child: SizedBox(                       width: _size!.width,                       height: _size!.height,                       child: Stack(                         children: [                           for (int index = 0; index &lt; _items!.length; index++)                             SvgPainterImage(                               item: _items![index],                               size: _size!,                               onTap: () => _onTap(index),                             )                         ],                       ),                     ),                   ),                 ),               ),             ),     );   } }  class SvgPainterImage extends StatelessWidget {   const SvgPainterImage({     super.key,     required this.item,     required this.size,     required this.onTap,   });   final PathSvgItem item;   final Size size;   final VoidCallback onTap;    @override   Widget build(BuildContext context) {     return CustomPaint(       size: size,       foregroundPainter: SvgPainter(item, onTap),     );   } } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <code>void _onTap(int index)<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c <code>PathSvgItem item<\/code>. \u0412 \u0432\u0438\u0434\u0436\u0435\u0442\u0435 <code>SvgPainterImage<\/code> \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>CustomPaint<\/code> \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u044b <code>Size size<\/code> svg \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b <code>hitTest()<\/code>. \u0418\u043d\u0430\u0447\u0435 \u043e\u043d \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0440\u0430\u0432\u043d\u044b\u043c\u0438 <code>Size.zero<\/code>, \u0438 \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0443 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0435\u043d <code>painter<\/code> \u043d\u0430 <code>foregroundPainter<\/code>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/701\/654\/13d\/70165413d3c8466150b5ebdbd2211494.gif\" width=\"296\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/701\/654\/13d\/70165413d3c8466150b5ebdbd2211494.gif\"\/><\/figure>\n<hr\/>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445?<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea5\/d6b\/750\/ea5d6b7505a9d9288891538b9b5b5509.gif\" width=\"296\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea5\/d6b\/750\/ea5d6b7505a9d9288891538b9b5b5509.gif\"\/><\/figure>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043b\u0430\u0433\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e42\/704\/d27\/e42704d2723d9cb77b2e4a00854625fd.png\" alt=\"Impeller\" title=\"Impeller\" width=\"2914\" height=\"1066\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e42\/704\/d27\/e42704d2723d9cb77b2e4a00854625fd.png\"\/><\/p>\n<div><figcaption>Impeller<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u043d\u043e\u0433\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u043d\u043e \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0435 \u0431\u044b\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0441\u043c\u0435\u043d\u0438\u043b \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0432\u0438\u0436\u043e\u043a. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 fluter \u043d\u0430 ios \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Impeller, \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u044d\u0442\u043e\u0442 \u0434\u0432\u0438\u0436\u043e\u043a \u043f\u043e\u043a\u0430 \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0446\u0438\u044f. \u042f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043e\u0431\u0435\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Skia. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/916\/fe5\/003\/916fe5003d20d8e260cb065073be4034.png\" alt=\"Skia\" title=\"Skia\" width=\"2914\" height=\"1066\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/916\/fe5\/003\/916fe5003d20d8e260cb065073be4034.png\"\/><\/p>\n<div><figcaption>Skia<\/figcaption><\/div>\n<\/figure>\n<p>\u042d\u0442\u043e \u0440\u0435\u0448\u0438\u043b\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0441 \u043b\u0430\u0433\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443. \u041d\u043e \u043f\u0440\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/949\/bc7\/2d2\/949bc72d24222422bbc6f2f834a7dc59.gif\" width=\"296\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/949\/bc7\/2d2\/949bc72d24222422bbc6f2f834a7dc59.gif\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de6\/a88\/1d0\/de6a881d04cfb739557817eb1abfba69.png\" alt=\"Skia\" title=\"Skia\" width=\"2914\" height=\"1066\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/de6\/a88\/1d0\/de6a881d04cfb739557817eb1abfba69.png\"\/><\/p>\n<div><figcaption>Skia<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u043e\u0433\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e-\u0445\u0438\u0442\u0440\u043e\u043c\u0443, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/787786\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a><\/p>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0435\u0439\u043d\u0442\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0438\u0441\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 <code>ui.Image<\/code>:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">class ImagePainter extends CustomPainter {   final ui.Image image;    const ImagePainter(this.image);    @override   void paint(Canvas canvas, Size size) {     final paint = Paint();     canvas.drawImage(image, Offset.zero, paint);   }    @override   bool shouldRepaint(ImagePainter oldDelegate) => false; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e <code>ui.Image<\/code> \u043f\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">  final GlobalKey _key = GlobalKey();   bool _isInteraction = false;   ui.Image? _image;    void _onInteractionStart() {     if (_isInteraction) return;     _image = (_key.currentContext!.findRenderObject()! as RenderRepaintBoundary).toImageSync();     setState(() {       _isInteraction = true;     });   }    void _onInteractionEnd() {     if (!_isInteraction) return;     setState(() {       _isInteraction = false;     });     _image?.dispose();     _image = null;   }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>build<\/code> \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">  @override   Widget build(BuildContext context) {     return Scaffold(       appBar: AppBar(title: const Text('Coloring SVG')),       body: _items == null || _size == null           ? const Center(child: CircularProgressIndicator())           : InteractiveViewer(               onInteractionStart: (_) => _onInteractionStart(),               onInteractionEnd: (_) => _onInteractionEnd(),               child: Center(                 child: FittedBox(                   child: _isInteraction                       ? CustomPaint(                           size: _size!,                           painter: ImagePainter(_image!),                         )                       \/\/ RepaintBoundary should be used to prevent rebuilds                       \/\/ during transformations with InteractiveViewer                       : RepaintBoundary(                           key: _key,                           child: SizedBox(                             width: _size!.width,                             height: _size!.height,                             child: Stack(                               children: [                                 for (int index = 0; index &lt; _items!.length; index++)                                   SvgPainterImage(                                     item: _items![index],                                     size: _size!,                                     onTap: () => _onTap(index),                                   )                               ],                             ),                           ),                         ),                 ),               ),             ),     );   }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443\u0436\u0435 \u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430, \u0430 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u0447\u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ffd\/1b6\/43b\/ffd1b643b990d9a79d23fc1236e4baa7.png\" alt=\"Skia\" title=\"Skia\" width=\"2914\" height=\"1118\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ffd\/1b6\/43b\/ffd1b643b990d9a79d23fc1236e4baa7.png\"\/><\/p>\n<div><figcaption>Skia<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e82\/e8a\/87d\/e82e8a87d0aedc9befd37fd05e6723a5.png\" alt=\"Impeller\" title=\"Impeller\" width=\"2914\" height=\"1156\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e82\/e8a\/87d\/e82e8a87d0aedc9befd37fd05e6723a5.png\"\/><\/p>\n<div><figcaption>Impeller<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441 \u043f\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a Impeller \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 Skia \u0432 \u043a\u0435\u0439\u0441\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.<br \/>\u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 \u0431\u0430\u0440\u044c\u0435\u0440, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u0430 \u043d\u0435 \u0441\u0430\u043c\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u043c. \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Impeller \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430.<\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c UI \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/792858\/\"> https:\/\/habr.com\/ru\/articles\/792858\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c, \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/791886\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043a\u0435\u0439\u0441\u0435.<\/p>\n<figure class=\"\"><\/figure>\n<hr\/>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0438<\/h2>\n<p>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u043e url<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0446\u0432\u0435\u0442<\/p>\n<\/li>\n<\/ol>\n<h4>\u041f\u0440\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430. <\/p>\n<p>SVG (Scalable Vector Graphics) \u2014 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e XML-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432. \u0412\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SVG \u0445\u043e\u0440\u043e\u0448\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a JPEG \u0438\u043b\u0438 PNG, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0445\u0443\u0434\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438.<\/p>\n<figure class=\"\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 svg<\/figcaption><\/div>\n<\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 SVG, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432\u044b\u0448\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;svg width=\"200\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">   &lt;!-- \u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u0433\u043b\u0430\u043c\u0438 -->   &lt;rect x=\"10\" y=\"10\" width=\"50\" height=\"50\" rx=\"10\" ry=\"10\" fill=\"red\" stroke=\"black\" stroke-width=\"2\"\/>    &lt;!-- \u0421\u0438\u043d\u0438\u0439 \u043a\u0440\u0443\u0433 -->   &lt;circle cx=\"100\" cy=\"50\" r=\"20\" fill=\"blue\" stroke=\"green\" stroke-width=\"3\"\/>    &lt;!-- \u0416\u0435\u043b\u0442\u044b\u0439 \u044d\u043b\u043b\u0438\u043f\u0441 -->   &lt;ellipse cx=\"160\" cy=\"50\" rx=\"20\" ry=\"10\" fill=\"yellow\" stroke=\"pink\" stroke-width=\"2\"\/>    &lt;!-- \u0427\u0435\u0440\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f -->   &lt;line x1=\"10\" y1=\"100\" x2=\"50\" y2=\"150\" stroke=\"black\" stroke-width=\"4\"\/>    &lt;!-- \u041f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u044f (\u043b\u043e\u043c\u0430\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f) -->   &lt;polyline points=\"60 100, 90 120, 120 100, 150 120\" stroke=\"orange\" stroke-width=\"2\" fill=\"none\"\/>    &lt;!-- \u041c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (\u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u0430) -->   &lt;polygon points=\"160 100, 190 120, 160 140, 130 120\" stroke=\"purple\" fill=\"lime\" stroke-width=\"1\"\/>    &lt;!-- \u041f\u0443\u0442\u044c (\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u0430) -->   &lt;path d=\"M10 160 Q 50 200, 90 160 T 170 160\" fill=\"none\" stroke=\"brown\" stroke-width=\"2\"\/> &lt;\/svg> <\/code><\/pre>\n<ol>\n<li>\n<p><strong>XML-\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435<\/strong>: \u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f XML-\u0444\u0430\u0439\u043b\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?><\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>SVG \u0442\u0435\u0433<\/strong>: \u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>&lt;svg width=\"200\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><\/code>. \u0418\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043e \u0442\u0430\u043a<code>viewBox=\"0 0 200 200\"<\/code>. <\/p>\n<\/li>\n<li>\n<p><strong>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/strong>: \u0412\u043d\u0443\u0442\u0440\u0438 SVG \u0442\u0435\u0433\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b (\u043b\u0438\u043d\u0438\u0438, \u043a\u0440\u0443\u0433\u0438, \u044d\u043b\u043b\u0438\u043f\u0441\u044b, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438 \u0442.\u0434.): \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>&lt;rect x=\"10\" y=\"10\" width=\"50\" height=\"50\" rx=\"10\" ry=\"10\"\/><\/code> \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0443\u0442\u0438 (<code>&lt;path><\/code>): \u0421\u0430\u043c\u044b\u0439 \u043c\u043e\u0449\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 SVG, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0438 \u043a\u0440\u0438\u0432\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043a\u0441\u0442 (<code>&lt;text><\/code>): \u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0443\u043f\u043f\u044b (<code>&lt;g><\/code>): \u0414\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SVG.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b<\/strong>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0440\u0430\u0437\u043c\u0435\u0440\u044b, \u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u043b\u0438\u0432\u043a\u0438,  \u043e\u0431\u0432\u043e\u0434\u043a\u0438, \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>fill=\"red\"<\/code> \u0437\u0430\u0434\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438.<\/p>\n<p>\u0418 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435. \u041d\u0430 \u043d\u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043e\u0441\u0442\u0440\u044f\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0430\u043f\u0438 Canvas \u0432\u043e flutter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 CustomPaint.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u043a\u0435\u0439\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044b\u0435 path.<\/p>\n<p><strong>\u0428\u0430\u0433\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u00a0\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430: <code>VectorImage<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438 \u0435\u0451 \u0440\u0430\u0437\u043c\u0435\u0440, <code>PathSvgItem<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c <code>Path path<\/code> \u0438 \u0446\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438 <code>Color? fill<\/code> <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ models.dart  import 'dart:ui';  class VectorImage {   const VectorImage({     required this.items,     this.size,   });    final List&lt;PathSvgItem> items;   final Size? size; }  class PathSvgItem {   const PathSvgItem({     required this.path,     this.fill,   });    final Path path;   final Color? fill; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c <code>CustomPainter<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ svg_painter.dart  import 'package:flutter\/material.dart';  import 'models.dart';  class SvgPainter extends CustomPainter {   const SvgPainter(this.pathSvgItem);   final PathSvgItem pathSvgItem;    @override   void paint(Canvas canvas, Size size) {     Path path = pathSvgItem.path;      final paint = Paint();     paint.color = pathSvgItem.fill ?? Colors.white;     paint.style = PaintingStyle.fill;      canvas.drawPath(path, paint);   }    @override   bool shouldRepaint(SvgPainter oldDelegate) => false; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 SVG \u0444\u0430\u0439\u043b\u0430 \u043f\u043e \u0443\u0440\u043b \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ utils.dart  import 'package:http\/http.dart' as http;  Future&lt;String> getSvgData(String url) async {   final http.Response data = await http.get(Uri.parse(url));   return data.body; }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 SVG \u0444\u0430\u0439\u043b\u0430.<\/strong> \u0417\u043d\u0430\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 SVG \u0444\u0430\u0439\u043b\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/pub.dev\/packages\/xml\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f XML \u0444\u0430\u0439\u043b\u043e\u0432<\/a>, \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ utils.dart  import 'package:flutter\/material.dart'; import 'package:path_drawing\/path_drawing.dart'; import 'package:xml\/xml.dart';  import 'models.dart';  VectorImage getVectorImageFromStringXml(String svgData) {   List&lt;PathSvgItem> items = [];    \/\/ step 1: parse the xml   XmlDocument document = XmlDocument.parse(svgData);    \/\/ step 2: get the size of the svg   Size? size;   String? width = document.findAllElements('svg').first.getAttribute('width');   String? height = document.findAllElements('svg').first.getAttribute('height');   String? viewBox = document.findAllElements('svg').first.getAttribute('viewBox');   if (width != null &amp;&amp; height != null) {     width = width.replaceAll(RegExp(r'[^0-9.]'), '');     height = height.replaceAll(RegExp(r'[^0-9.]'), '');     size = Size(double.parse(width), double.parse(height));   } else if (viewBox != null) {     List&lt;String> viewBoxList = viewBox.split(' ');     size = Size(double.parse(viewBoxList[2]), double.parse(viewBoxList[3]));   }    \/\/ step 3: get the paths   final List&lt;XmlElement> paths = document.findAllElements('path').toList();   for (int i = 0; i &lt; paths.length; i++) {     final XmlElement element = paths[i];      \/\/ get the path     String? pathString = element.getAttribute('d');     if (pathString == null) {       continue;     }     Path path = parseSvgPathData(pathString);      \/\/ get the fill color     String? fill = element.getAttribute('fill');     String? style = element.getAttribute('style');     if (style != null) {       fill = _getFillColor(style);     }      \/\/ get the transformations     String? transformAttribute = element.getAttribute('transform');     double scaleX = 1.0;     double scaleY = 1.0;     double? translateX;     double? translateY;     if (transformAttribute != null) {       ({double x, double y})? scale = _getScale(transformAttribute);       if (scale != null) {         scaleX = scale.x;         scaleY = scale.y;       }       ({double x, double y})? translate = _getTranslate(transformAttribute);       if (translate != null) {         translateX = translate.x;         translateY = translate.y;       }     }      final Matrix4 matrix4 = Matrix4.identity();     if (translateX != null &amp;&amp; translateY != null) {       matrix4.translate(translateX, translateY);     }     matrix4.scale(scaleX, scaleY);      path = path.transform(matrix4.storage);      items.add(PathSvgItem(       fill: _getColorFromString(fill),       path: path,     ));   }    return VectorImage(items: items, size: size); }  ({double x, double y})? _getScale(String data) {   RegExp regExp = RegExp(r'scale\\(([^,]+),([^)]+)\\)');   var match = regExp.firstMatch(data);    if (match != null) {     double scaleX = double.parse(match.group(1)!);     double scaleY = double.parse(match.group(2)!);      return (x: scaleX, y: scaleY);   } else {     return null;   } }  ({double x, double y})? _getTranslate(String data) {   RegExp regExp = RegExp(r'translate\\(([^,]+),([^)]+)\\)');   var match = regExp.firstMatch(data);    if (match != null) {     double translateX = double.parse(match.group(1)!);     double translateY = double.parse(match.group(2)!);      return (x: translateX, y: translateY);   } else {     return null;   } }  String? _getFillColor(String data) {   RegExp regExp = RegExp(r'fill:\\s*(#[a-fA-F0-9]{6})');   RegExpMatch? match = regExp.firstMatch(data);    return match?.group(1); }  Color _hexToColor(String hex) {   final buffer = StringBuffer();   if (hex.length == 6 || hex.length == 7) buffer.write('ff');   buffer.write(hex.replaceFirst('#', ''));   return Color(int.parse(buffer.toString(), radix: 16)); }  Color? _getColorFromString(String? colorString) {   if (colorString == null) return null;   if (colorString.startsWith('#')) {     return _hexToColor(colorString);   } else {     switch (colorString) {       case 'red':         return Colors.red;       case 'green':         return Colors.green;       case 'blue':         return Colors.blue;       case 'yellow':         return Colors.yellow;       case 'white':         return Colors.white;       case 'black':         return Colors.black;       default:         return Colors.transparent;     }   } } <\/code><\/pre>\n<p>\u0418\u0437-\u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0445\u044d\u043b\u043f\u0435\u0440\u043e\u0432. \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043a\u0435\u0439\u0441\u044b, \u0438 \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u043c\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443. \u041d\u043e \u044f \u0442\u0430\u043a\u043e\u0439 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f ChatGPT \u0434\u043b\u044f \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430.<\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e, \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e, \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 XML \u043e\u0431\u044a\u0435\u043a\u0442, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 <code>width<\/code> \u0438 <code>height<\/code>, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 <code>viewBox<\/code><\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 path, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c. \u0414\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Path<\/code> \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/pub.dev\/packages\/path_drawing\" rel=\"noopener noreferrer nofollow\">path_drawing<\/a>: <br \/><code>Path parseSvgPathData(String svg)<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<br \/>&#8212; \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 &#171;red&#187;, &#171;blue&#187; \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 hex<br \/>&#8212; \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043b\u0438\u043d\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (0;0) \u0438 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u0443\u0447\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 <code>VectorImage<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u043a\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u0430\u043a <code>strokeWidth<\/code>, <code>strokeJoin<\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-367883","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=367883"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367883\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}