Last active
December 2, 2020 23:03
-
-
Save roipeker/04379452b7e374ab666607ad8e37dce1 to your computer and use it in GitHub Desktop.
graphx drawing sample (svg in arabic)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker 2020 | |
import 'package:graphx/graphx.dart'; | |
import 'logo_drawer.dart'; | |
import 'svg_data.dart'; | |
class DemoBismillah extends Sprite { | |
LogoDrawerSprite bismillah; | |
@override | |
Future<void> addedToStage() async { | |
bismillah = await buildLogo(bismillahSvgString); | |
bismillah.alignPivot(); | |
bismillah.scale = .5; | |
bismillah.setPosition(stage.stageWidth / 2, stage.stageHeight / 2); | |
bismillah.fill.graphics.beginFill(0x0); | |
bismillah.drawPercent(1.0, graphics: bismillah.fill.graphics); | |
bismillah.fill.graphics.endFill(); | |
bismillah.fill.alpha = 0; | |
var percentTween = 0.0.twn; | |
percentTween.tween(1.0, duration: 3, ease: GEase.easeInOutSine, | |
onUpdate: () { | |
final g = bismillah.line.graphics; | |
g.clear(); | |
g.lineStyle(0, 0x0); | |
bismillah.drawPercent(percentTween.value, graphics: g); | |
g.endFill(); | |
}, onComplete: () { | |
bismillah.fill.tween(duration: 2, alpha: 1); | |
bismillah.tween( | |
duration: 1, | |
delay: 2, | |
alpha: 0, | |
ease: GEase.easeOutSine, | |
); | |
bismillah.tween( | |
duration: .9, | |
scale: '0.80', | |
delay: 2, | |
ease: GEase.easeInExpo, | |
); | |
}); | |
} | |
Future<LogoDrawerSprite> buildLogo(word) async { | |
var logo = LogoDrawerSprite(); | |
await logo.parseSvg(word); | |
addChild(logo); | |
return logo; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker 2020 | |
/// Sprite that will hold a SVG path drawing with a | |
/// filled and outlined version... and the ability to partially | |
/// draw the outlined based on percentage. | |
class LogoDrawerSprite extends Sprite { | |
List<PathMetric> _metricsList; | |
Path _rootPath; | |
Shape line; | |
Shape fill; | |
LogoDrawerSprite() { | |
_init(); | |
} | |
void _init() { | |
line = Shape(); | |
fill = Shape(); | |
addChild(line); | |
addChild(fill); | |
} | |
Future<void> parseSvg(word) async { | |
var svgElement = await SvgUtils.svgStringToSvgDrawable(word); | |
final letters = <Path>[]; | |
void _populateData(DrawableParent svgElement) { | |
if (svgElement.hasDrawableContent) { | |
for (var c in svgElement.children) { | |
if (c is DrawableGroup) { | |
_populateData(c); | |
} else if (c is DrawableShape) { | |
letters.add(c.path); | |
} | |
} | |
} | |
} | |
_populateData(svgElement); | |
_rootPath = letters.reduce( | |
(path1, path2) => Path.combine(PathOperation.union, path1, path2), | |
); | |
_metricsList = _rootPath.computeMetrics(forceClosed: false).toList(); | |
line.graphics.lineStyle(1, Colors.white.value); | |
drawPercent(1, graphics: line.graphics); | |
line.graphics.endFill(); | |
} | |
void drawPercent(double percent, {Graphics graphics}) { | |
if (graphics == null) { | |
graphics = line.graphics; | |
} | |
_metricsList.forEach((m) { | |
graphics.drawPath(m.extractPath(0, m.length * percent)); | |
}); | |
} | |
void drawFill(Color color) { | |
fill.graphics.clear(); | |
fill.graphics.beginFill(color.value); | |
fill.graphics.drawPath(_rootPath); | |
fill.graphics.endFill(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker 2020 | |
import 'demo_bismillah.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:graphx/graphx.dart'; | |
void main() { | |
runApp( | |
MaterialApp( | |
home: Scaffold( | |
body: SceneBuilderWidget( | |
builder: () => SceneController(back: DemoBismillah()), | |
), | |
), | |
), | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker 2020 | |
const bismillahSvgString = ''' | |
<svg width="711" height="159" viewBox="0 0 711 159" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
<g clip-path="url(#clip0)"> | |
<path d="M670.222 64.0076C670.622 63.2076 671.122 62.3076 672.022 62.4076C673.022 62.5076 674.022 63.0077 674.722 63.8077C675.122 64.3077 675.322 65.1076 674.822 65.6076C674.522 65.9076 674.422 66.4076 674.022 66.6076C673.522 66.0076 673.022 64.9076 671.922 64.9076C670.722 65.5076 670.122 66.8076 669.822 68.0076C669.222 70.5076 669.322 73.2076 669.222 75.9076C669.022 76.2076 668.622 76.3076 668.422 76.6076C668.222 74.0076 667.422 71.2076 665.322 69.4076C664.422 69.4076 663.322 69.3076 662.722 68.6076C662.022 67.5076 661.422 66.2076 661.722 64.9076C662.622 64.6076 663.522 65.3077 664.222 65.8077C666.122 67.2077 667.422 69.2077 668.522 71.2077C668.922 68.7077 669.322 66.2076 670.222 64.0076Z" fill="#020203"/> | |
<path d="M340.522 50.2077C340.922 49.4077 341.422 48.5076 342.322 48.6076C343.322 48.7076 344.322 49.2076 345.022 50.0076C345.422 50.5076 345.622 51.3077 345.122 51.8077C344.822 52.1077 344.722 52.6077 344.322 52.8077C343.822 52.2077 343.322 51.1076 342.222 51.1076C341.022 51.7076 340.422 53.0077 340.122 54.2077C339.522 56.7077 339.622 59.4076 339.522 62.1076C339.322 62.4076 338.922 62.5077 338.722 62.8077C338.522 60.2077 337.722 57.4076 335.622 55.6076C334.722 55.6076 333.622 55.5077 333.022 54.8077C332.322 53.7077 331.722 52.4076 332.022 51.1076C332.922 50.8076 333.822 51.5076 334.522 52.0076C336.422 53.4076 337.722 55.4076 338.822 57.4076C339.222 54.9076 339.522 52.4077 340.522 50.2077Z" fill="#020203"/> | |
<path d="M186.522 1.60765C186.922 0.80765 187.422 -0.0923565 188.322 0.00764346C189.322 0.107643 190.322 0.607637 191.022 1.40764C191.422 1.90764 191.622 2.70766 191.122 3.20766C190.822 3.50766 190.722 4.00766 190.322 4.20766C189.822 3.60766 189.322 2.50764 188.222 2.50764C187.022 3.10764 186.422 4.40765 186.122 5.60765C185.522 8.10765 185.622 10.8076 185.522 13.5076C185.322 13.8076 184.922 13.9077 184.722 14.2077C184.522 11.6077 183.722 8.80764 181.622 7.00764C180.722 7.00764 179.622 6.90766 179.022 6.20766C178.322 5.10766 177.722 3.80764 178.022 2.50764C178.922 2.20764 179.822 2.90764 180.522 3.40764C182.422 4.80764 183.722 6.80766 184.822 8.80766C185.222 6.30766 185.522 3.90765 186.522 1.60765Z" fill="#020203"/> | |
<path d="M290.422 36.8076C290.522 36.8076 290.522 36.8076 290.622 36.8076C290.622 36.8076 290.522 45.3076 293.222 44.1076C295.922 42.9076 295.022 37.5076 295.022 37.5076L296.322 36.1076L296.822 39.9076C296.922 40.8076 297.022 41.7076 296.922 42.7076C296.622 47.5076 294.022 49.8076 291.122 48.5076C289.922 47.9076 289.422 46.4076 289.222 44.8076C288.822 46.4076 288.022 47.9076 286.922 48.4076C285.522 49.0076 284.222 48.2076 283.422 46.9076C282.622 45.6076 282.122 43.9076 282.322 42.2076C282.422 40.9076 282.922 39.5076 283.722 38.3076C283.822 38.0076 284.422 37.4076 284.622 37.1076C284.622 37.1076 283.022 42.5076 285.522 43.7076C288.022 44.9076 289.122 36.3076 289.122 36.3076C289.722 36.7076 290.022 36.8076 290.422 36.8076Z" fill="#020203"/> | |
<path d="M199.222 33.1076C199.322 33.1076 199.322 33.1076 199.422 33.1076C199.422 33.1076 199.322 41.6076 202.022 40.4076C204.722 39.2076 203.822 33.8076 203.822 33.8076L205.122 32.4076L205.622 36.2076C205.722 37.1076 205.822 38.0076 205.722 39.0076C205.422 43.8076 202.822 46.1076 199.922 44.8076C198.722 44.2076 198.222 42.7076 198.022 41.1076C197.622 42.7076 196.822 44.2076 195.722 44.7076C194.322 45.3076 193.022 44.5076 192.222 43.2076C191.422 41.9076 190.922 40.2076 191.122 38.5076C191.222 37.2076 191.722 35.8076 192.522 34.6076C192.622 34.3076 193.222 33.7076 193.422 33.4076C193.422 33.4076 191.822 38.8076 194.322 40.0076C196.822 41.2076 197.922 32.6076 197.922 32.6076C198.522 33.0076 198.822 33.1076 199.222 33.1076Z" fill="#020203"/> | |
<path d="M89.6222 24.0076C89.7222 24.0076 89.7222 24.0076 89.8222 24.0076C89.8222 24.0076 89.7222 32.5076 92.4222 31.3076C95.1222 30.1076 94.2222 24.7076 94.2222 24.7076L95.5222 23.3076L96.0222 27.1076C96.1222 28.0076 96.2222 28.9076 96.1222 29.9076C95.8222 34.7076 93.2222 37.0076 90.3222 35.7076C89.1222 35.1076 88.6222 33.6076 88.4222 32.0076C88.0222 33.6076 87.2222 35.1076 86.1222 35.6076C84.7222 36.2076 83.4222 35.4076 82.6222 34.1076C81.8222 32.8076 81.3222 31.1076 81.5222 29.4076C81.6222 28.1076 82.1222 26.7076 82.9222 25.5076C83.0222 25.2076 83.6222 24.6076 83.8222 24.3076C83.8222 24.3076 82.2222 29.7076 84.7222 30.9076C87.2222 32.1076 88.3222 23.5076 88.3222 23.5076C88.9222 23.9076 89.3222 23.9076 89.6222 24.0076Z" fill="#020203"/> | |
<path d="M685.522 112.408L683.722 116.308C683.322 117.208 683.522 118.308 684.322 118.808L689.222 122.408C689.922 122.908 690.922 122.708 691.322 122.008C691.922 121.008 692.822 119.508 693.422 118.408C693.822 117.608 693.722 116.608 693.022 115.908C691.922 114.808 690.022 113.208 688.022 111.708C687.222 111.108 685.922 111.508 685.522 112.408Z" fill="#020203"/> | |
<path d="M114.922 102.408L113.122 106.308C112.722 107.208 112.922 108.308 113.722 108.808L118.622 112.408C119.322 112.908 120.322 112.708 120.722 112.008C121.322 111.008 122.222 109.508 122.822 108.408C123.222 107.608 123.122 106.608 122.422 105.908C121.322 104.808 119.422 103.208 117.422 101.708C116.522 101.108 115.322 101.408 114.922 102.408Z" fill="#020203"/> | |
<path d="M31.8222 118.108L30.0222 122.008C29.6222 122.908 29.8222 124.008 30.6222 124.508L35.5222 128.108C36.2222 128.608 37.2222 128.408 37.6222 127.708C38.2222 126.708 39.1222 125.208 39.7222 124.108C40.1222 123.308 40.0222 122.308 39.3222 121.608C38.2222 120.508 36.3222 118.908 34.3222 117.408C33.5222 116.808 32.3222 117.108 31.8222 118.108Z" fill="#020203"/> | |
<path d="M20.8222 121.108L19.0222 125.008C18.6222 125.908 18.8222 127.008 19.6222 127.508L24.5222 131.108C25.2222 131.608 26.2222 131.408 26.6222 130.708C27.2222 129.708 28.1222 128.208 28.7222 127.108C29.1222 126.308 29.0222 125.308 28.3222 124.608C27.2222 123.508 25.3222 121.908 23.3222 120.408C22.5222 119.808 21.2222 120.108 20.8222 121.108Z" fill="#020203"/> | |
<path d="M660.922 141.608C660.922 141.608 680.622 135.608 690.922 132.708C701.222 129.908 707.622 127.608 710.922 124.608C710.922 124.608 692.322 130.108 685.922 131.908C679.522 133.708 664.922 137.608 660.922 141.608Z" fill="#020203"/> | |
<path d="M209.822 133.408C209.822 133.408 228.622 124.908 238.522 120.808C248.422 116.708 254.422 113.508 257.222 110.208C257.222 110.208 239.522 118.008 233.422 120.708C227.222 123.208 213.222 129.008 209.822 133.408Z" fill="#020203"/> | |
<path d="M250.422 38.9076C250.422 38.9076 271.022 29.6076 281.822 25.0076C292.622 20.5076 299.322 17.0076 302.322 13.3076C302.322 13.3076 282.922 21.9076 276.222 24.8076C269.522 27.7076 254.222 34.0076 250.422 38.9076Z" fill="#020203"/> | |
<path d="M42.5222 28.9076C42.5222 28.9076 65.5222 20.2076 77.6222 16.0076C89.7222 11.8076 97.1222 8.60765 100.722 4.80765C100.722 4.80765 79.0222 12.7076 71.5222 15.4076C64.0222 18.1076 46.9222 23.9076 42.5222 28.9076Z" fill="#020203"/> | |
<path d="M147.122 39.7076C147.122 39.7076 171.822 28.8076 184.822 23.5076C197.822 18.2076 205.822 14.2076 209.522 9.80765C209.522 9.80765 186.222 19.8076 178.122 23.2076C170.122 26.6076 151.722 34.0076 147.122 39.7076Z" fill="#020203"/> | |
<path d="M313.022 129.808C313.022 129.808 325.922 124.008 332.722 121.108C339.522 118.308 343.722 116.108 345.622 113.808C345.622 113.808 333.422 119.208 329.222 121.008C325.022 122.808 315.322 126.708 313.022 129.808Z" fill="#020203"/> | |
<path d="M132.122 130.808C132.122 130.808 145.022 125.008 151.822 122.108C158.622 119.308 162.822 117.108 164.722 114.808C164.722 114.808 152.522 120.208 148.322 122.008C144.122 123.808 134.522 127.708 132.122 130.808Z" fill="#020203"/> | |
<path d="M10.6222 114.108C10.6222 114.108 23.5222 108.308 30.3222 105.408C37.1222 102.608 41.3222 100.408 43.2222 98.1076C43.2222 98.1076 31.0222 103.508 26.8222 105.308C22.6222 107.008 13.0222 111.008 10.6222 114.108Z" fill="#020203"/> | |
<path d="M58.8222 91.3076C58.8222 91.3076 71.7222 85.5076 78.5222 82.6076C85.3222 79.8076 89.5222 77.6076 91.4222 75.3076C91.4222 75.3076 79.2222 80.7076 75.0222 82.5076C70.8222 84.3076 61.2222 88.3076 58.8222 91.3076Z" fill="#020203"/> | |
<path d="M669.422 48.9076C669.322 47.5076 669.122 46.7076 667.922 45.6076C666.622 44.4076 665.922 42.7076 666.122 41.0076C665.122 41.4076 664.322 42.3076 664.222 43.4076L664.022 45.2076C664.022 45.2076 661.822 48.9076 663.722 51.0076C665.422 53.2076 669.522 50.9076 669.422 48.9076ZM665.722 50.4076C663.222 50.0076 665.122 46.4076 665.122 46.4076C665.122 46.4076 666.122 47.6076 667.222 48.1076C668.222 48.6076 668.222 50.7076 665.722 50.4076Z" fill="#020203"/> | |
<path d="M344.022 71.9076C343.922 70.5076 343.722 69.7076 342.522 68.6076C341.222 67.4076 340.522 65.7076 340.722 64.0076C339.722 64.4076 338.922 65.3076 338.822 66.4076L338.622 68.2076C338.622 68.2076 336.422 71.9076 338.322 74.0076C340.022 76.2076 344.122 73.9076 344.022 71.9076ZM340.322 73.4076C337.822 73.0076 339.722 69.4076 339.722 69.4076C339.722 69.4076 340.722 70.6076 341.822 71.1076C342.822 71.6076 342.822 73.7076 340.322 73.4076Z" fill="#020203"/> | |
<path d="M178.622 43.5076C178.522 42.1076 178.322 41.3076 177.122 40.2076C175.822 39.0076 175.122 37.3076 175.322 35.6076C174.322 36.0076 173.522 36.9076 173.422 38.0076L173.222 39.8076C173.222 39.8076 171.022 43.5076 172.922 45.6076C174.722 47.8076 178.722 45.5076 178.622 43.5076ZM175.022 45.0076C172.522 44.6076 174.422 41.0076 174.422 41.0076C174.422 41.0076 175.422 42.2076 176.522 42.7076C177.522 43.3076 177.422 45.4076 175.022 45.0076Z" fill="#020203"/> | |
<path d="M32.2222 45.6076C32.1222 44.2076 31.9222 43.4076 30.7222 42.3076C29.4222 41.1076 28.7222 39.4076 28.9222 37.7076C27.9222 38.1076 27.1222 39.0076 27.0222 40.1076L26.8222 41.9076C26.8222 41.9076 24.6222 45.6076 26.5222 47.7076C28.3222 49.9076 32.3222 47.6076 32.2222 45.6076ZM28.5222 47.1076C26.0222 46.7076 27.9222 43.1076 27.9222 43.1076C27.9222 43.1076 28.9222 44.3076 30.0222 44.8076C31.1222 45.3076 31.0222 47.4076 28.5222 47.1076Z" fill="#020203"/> | |
<path d="M319.422 33.7076L319.522 31.3076L311.822 13.5076L309.222 22.1076C309.222 22.1076 310.522 21.9076 311.622 31.1076C312.722 40.3076 319.022 90.5076 317.922 101.908C317.922 101.908 322.022 95.3076 321.522 82.2076C321.122 69.1076 314.822 37.1076 315.522 29.9076L319.422 33.7076Z" fill="#020203"/> | |
<path d="M271.922 48.0076C270.622 43.4076 267.922 41.8076 266.022 41.3076C264.822 40.9076 263.522 41.4076 262.822 42.4076C256.922 51.0076 263.422 53.5076 263.422 53.5076C259.222 56.7076 253.022 60.2076 248.222 62.6076C246.322 47.8076 243.022 28.9076 243.522 23.5076L247.222 27.4076L247.322 25.0076L239.622 7.20764L237.022 15.8076C237.022 15.8076 238.322 15.6076 239.422 24.8076C240.022 29.9076 242.222 47.9076 243.922 64.7076C242.222 65.5076 241.122 66.0076 241.122 66.0076C239.022 67.3076 238.622 69.1076 238.622 69.1076C240.222 68.8076 242.222 68.2076 244.222 67.3076C245.422 79.6076 246.222 90.8076 245.822 95.5076C245.822 95.5076 249.922 88.9076 249.422 75.8076C249.322 73.0076 248.922 69.4076 248.522 65.3076C256.922 61.1076 265.722 54.9076 265.722 54.9076C270.222 57.0076 274.122 55.6076 271.922 48.0076ZM265.722 50.7076C265.722 50.7076 263.522 49.8076 262.822 48.7076C262.122 47.6076 264.722 46.0076 264.722 46.0076C267.022 47.2076 265.722 50.7076 265.722 50.7076ZM269.822 52.2076C268.522 52.6076 267.422 51.8076 267.422 51.8076C266.622 51.2076 268.122 47.9076 268.122 47.9076C269.822 48.5076 271.122 51.9076 269.822 52.2076Z" fill="#020203"/> | |
<path d="M139.922 25.4076L140.022 23.0076L132.322 5.20764L129.722 13.8076C129.722 13.8076 131.022 13.6076 132.122 22.8076C133.222 32.0076 139.522 82.2076 138.422 93.6076C138.422 93.6076 142.522 87.0076 142.022 73.9076C141.622 60.8076 135.322 28.8076 136.022 21.6076L139.922 25.4076Z" fill="#020203"/> | |
<path d="M700.622 77.4076L693.422 60.0076L698.322 62.5076V59.7076L689.422 47.9076L686.022 55.2076L700.422 91.7076C700.422 91.7076 698.822 95.2076 692.322 93.7076C685.722 92.1076 687.122 86.0076 687.122 85.6076C687.122 85.2076 684.222 85.2076 681.522 93.2076C678.822 100.908 667.722 94.6076 672.822 87.1076C673.022 86.8076 672.722 86.4076 672.422 86.5076C671.022 87.1076 668.322 88.9076 665.522 94.2076C661.322 102.108 648.422 97.1076 653.422 89.0076L654.422 87.3076C654.422 87.3076 614.222 94.8076 601.022 96.1076C587.822 97.4076 430.122 126.108 348.122 90.1076L346.122 90.8076V92.8076C346.122 92.8076 331.022 87.9076 318.622 104.108C306.222 120.308 300.422 124.608 294.922 122.708C289.722 120.808 290.122 109.808 295.022 103.108C295.422 103.108 295.922 103.108 296.322 103.108C297.322 103.108 298.322 102.908 299.422 102.608C303.722 101.508 305.022 97.2076 305.322 93.1076C305.722 89.0076 304.722 85.0076 303.022 81.3076L298.122 71.5076L300.722 73.6076L301.222 70.9076C301.222 70.9076 296.322 62.5076 292.422 60.0076C292.422 60.0076 292.322 64.5076 292.022 67.5076C291.922 69.1076 292.222 70.6076 293.022 72.0076C295.522 76.6076 301.022 86.9076 301.622 90.1076C302.322 94.2076 298.122 97.4076 290.722 93.4076C283.222 89.5076 281.022 61.5076 281.022 61.5076L278.522 66.3076C277.722 67.9076 277.522 69.7076 278.122 71.3076C279.622 76.2076 282.122 86.8076 278.922 94.1076C277.322 97.7076 274.222 100.108 270.222 99.3076C263.222 98.0076 263.922 90.2076 263.722 84.7076C263.622 80.3076 263.522 75.9076 263.422 71.5076C263.422 70.5076 263.422 69.5076 263.422 68.6076H262.922C261.222 68.8076 259.822 69.8076 259.022 71.2076C257.822 73.3076 255.922 77.0076 254.622 83.1076C254.222 85.1076 253.422 89.5076 253.322 91.6076C253.022 95.7076 251.322 102.308 245.722 102.208C238.622 102.108 237.622 88.1076 237.622 88.1076C237.322 91.4076 237.522 95.2076 238.422 98.5076C239.122 101.408 240.622 104.008 243.222 105.508C246.422 107.408 251.022 107.108 253.122 103.708C255.622 99.8076 255.922 95.3076 256.222 90.9076C256.222 90.9076 256.922 82.9076 259.722 78.6076L259.922 95.6076C259.922 95.6076 260.422 106.708 270.622 106.708C280.822 106.708 283.622 91.8076 283.722 92.0076C283.722 92.0076 283.622 91.0076 284.722 94.4076C284.722 94.4076 284.722 94.4076 284.722 94.5076C286.122 98.4076 289.222 101.408 293.022 102.508C290.922 106.408 281.822 124.808 297.222 129.308C314.422 134.308 316.422 94.3076 345.922 100.108C345.922 100.108 346.222 113.708 356.422 116.808C356.422 116.808 360.622 110.008 358.222 104.208C358.222 104.208 404.222 118.308 483.422 114.308C562.722 110.408 648.422 95.3076 648.422 95.3076C648.422 95.3076 648.122 107.708 659.622 104.808C662.922 104.008 665.622 100.708 668.022 96.5076C668.022 96.5076 668.722 105.008 675.422 104.008C682.122 102.908 683.222 96.2076 683.222 96.2076C683.222 96.2076 683.722 93.3076 685.322 92.9076C685.322 92.9076 685.822 103.308 697.922 101.208C709.822 99.3076 700.622 77.4076 700.622 77.4076ZM354.422 110.208C354.422 110.208 348.922 108.208 350.622 101.908L354.122 102.908C354.222 102.908 356.122 107.508 354.422 110.208Z" fill="#020203"/> | |
<path d="M228.022 80.9076C227.822 78.1076 227.622 75.3076 227.322 72.5076C226.522 64.1076 225.422 55.7076 224.222 47.3076C223.522 42.1076 222.822 36.9076 222.222 31.7076C221.922 28.4076 221.322 24.9076 221.722 21.5076L225.422 25.4076L225.522 23.0076L217.822 5.20764L215.222 13.8076C215.222 13.8076 216.522 13.6076 217.622 22.8076C218.522 30.6076 223.222 67.8076 223.922 85.9076C224.022 88.7076 222.122 91.3076 219.322 91.8076C218.822 91.9076 218.322 92.0076 217.722 92.0076C211.622 92.4076 209.022 89.0076 207.822 85.8076L206.322 94.1076C206.322 94.1076 213.622 101.708 211.722 107.108C209.822 112.508 188.522 124.308 181.522 123.608C174.622 122.908 162.322 116.108 175.222 94.9076C176.922 96.0076 179.322 96.7076 182.722 96.7076C182.722 96.7076 182.822 93.2076 182.722 88.9076C182.722 88.9076 181.122 84.9076 178.922 84.2076C178.922 84.2076 204.622 71.5076 209.522 70.9076L212.122 63.1076C212.122 63.1076 169.722 56.3076 157.522 59.1076C157.522 59.1076 149.722 61.2076 150.322 68.3076C150.922 75.4076 156.522 79.1076 162.822 81.1076C169.122 83.2076 168.322 83.5076 168.322 83.5076C168.322 83.5076 155.322 88.8076 133.522 111.708C111.722 134.608 98.5222 138.908 92.8222 130.808C87.0222 122.708 97.1222 107.108 97.1222 107.108C97.1222 107.108 110.122 105.308 106.022 88.4076C106.022 88.4076 117.322 90.3076 118.622 72.6076C118.622 72.6076 118.622 72.6076 118.622 72.7076C118.822 70.6076 119.022 68.2076 118.922 65.5076C118.522 53.6076 112.822 24.6076 113.522 18.0076L116.922 21.5076L117.022 19.3076L110.022 3.10764L107.622 10.9076C107.622 10.9076 108.822 10.7076 109.822 19.1076C110.722 26.4076 115.122 62.2076 115.622 78.0076C113.622 80.1076 110.522 81.7076 105.722 80.4076C102.622 79.5076 100.622 76.9076 99.4222 73.7076L98.1222 82.5076C98.1222 82.5076 103.022 87.7076 103.322 92.8076C103.622 98.0076 82.0222 111.308 72.6222 111.008C63.2222 110.708 54.7222 107.708 54.7222 96.6076C54.7222 85.5076 54.7222 76.6076 54.7222 76.6076C54.7222 76.6076 57.2222 79.8076 69.5222 73.5076C81.8222 67.2076 91.3222 60.1076 100.622 59.5076L103.722 50.9076C103.722 50.9076 97.4222 51.9076 88.1222 48.5076C78.8222 45.1076 54.9222 36.4076 48.4222 48.5076C48.4222 48.5076 46.0222 54.6076 46.2222 56.5076C46.2222 56.5076 14.2222 67.7076 12.2222 76.7076C12.2222 76.7076 -0.477778 84.7076 0.222222 96.9076C0.222222 96.9076 -0.277778 107.508 0.222222 109.908C0.722222 112.308 10.0222 144.108 8.42223 159.408L10.5222 156.308C10.5222 156.308 11.2222 124.208 3.52223 104.708C1.82223 100.408 2.02222 95.6076 4.22222 91.5076C5.72222 88.8076 8.32222 86.1076 12.6222 84.4076C12.6222 84.4076 17.5222 92.7076 27.5222 90.5076C27.5222 90.5076 29.6222 82.8076 19.8222 76.8076C19.8222 76.8076 35.4222 66.8076 45.9222 65.0076C45.9222 65.0076 48.4222 72.7076 50.9222 75.6076C50.9222 75.6076 52.7222 96.6076 52.1222 102.508C51.5222 108.408 58.3222 130.308 92.1222 111.808C92.1222 111.808 84.6222 132.508 90.2222 138.108C95.8222 143.708 107.722 146.108 122.822 131.808C137.922 117.508 160.922 91.5076 171.322 89.3076C171.322 89.3076 171.622 92.2076 174.322 94.5076C171.122 99.7076 158.722 122.308 175.322 131.708C183.422 136.308 195.822 129.308 207.622 119.608C213.422 114.808 216.222 107.108 214.722 99.7076C214.722 99.6076 214.722 99.5076 214.722 99.5076C214.722 99.5076 226.322 99.6076 228.022 89.8076C228.622 86.6076 228.222 83.7076 228.022 80.9076ZM53.2222 66.0076C52.5222 63.9076 49.4222 56.2076 49.4222 56.2076C52.3222 47.7076 64.5222 50.9076 66.1222 51.3076C67.7222 51.7076 89.1222 55.6076 89.1222 55.6076L88.4222 57.7076C77.9222 61.4076 78.5222 63.3076 69.3222 67.3076C60.0222 71.3076 53.9222 68.1076 53.2222 66.0076ZM174.422 79.9076C173.822 77.5076 154.222 69.1076 154.222 69.1076C153.922 68.2076 157.322 66.9076 157.322 66.9076C168.522 64.1076 196.622 68.9076 196.622 68.9076V69.8076L174.422 79.9076Z" fill="#020203"/> | |
<path d="M162.222 23.3076C162.422 21.4076 162.322 19.5076 161.922 17.7076C161.522 15.9076 160.822 14.2076 159.922 12.7076C159.722 12.3076 159.422 12.0076 159.122 11.7076C158.822 11.4076 158.622 11.0076 158.222 10.8076C157.922 10.5076 157.622 10.2076 157.322 9.90762C157.022 9.60762 156.722 9.30763 156.422 9.00763C156.122 8.70763 155.822 8.30764 155.522 8.10764C155.222 7.80764 154.822 7.50764 154.522 7.10764C153.822 6.50764 153.122 5.80763 152.522 5.00763L152.622 4.70764C153.622 4.80764 154.722 4.90765 155.622 5.30765C156.122 5.50765 156.522 5.70762 157.022 5.90762C157.222 6.00762 157.522 6.10765 157.722 6.30765L158.322 6.80765C160.122 7.90765 161.122 9.90765 162.022 11.8076C162.222 12.3076 162.422 12.7076 162.622 13.2076L163.022 14.7076L163.322 16.2076L163.422 17.7076C163.422 19.7076 163.222 21.7076 162.522 23.5076L162.222 23.3076Z" fill="#020203"/> | |
<path d="M270.622 23.5076C270.822 21.6076 270.722 19.7076 270.322 17.9076C269.922 16.1076 269.222 14.4076 268.322 12.9076C268.122 12.5076 267.822 12.2076 267.522 11.9076C267.222 11.6076 267.022 11.2076 266.622 11.0076C266.322 10.7076 266.022 10.4076 265.722 10.1076C265.422 9.80764 265.122 9.50764 264.822 9.20764C264.522 8.90764 264.222 8.50765 263.922 8.30765C263.622 8.00765 263.222 7.70765 262.922 7.30765C262.222 6.70765 261.522 6.00764 260.922 5.20764L261.022 4.90762C262.022 5.00762 263.122 5.10763 264.022 5.50763C264.522 5.70763 264.922 5.90764 265.422 6.10764C265.622 6.20764 265.922 6.30763 266.122 6.50763L266.722 7.00763C268.522 8.10763 269.522 10.1076 270.422 12.0076C270.622 12.5076 270.822 12.9076 271.022 13.4076L271.422 14.9076L271.722 16.4076L271.822 17.9076C271.822 19.9076 271.622 21.9076 270.922 23.7076L270.622 23.5076Z" fill="#020203"/> | |
</g> | |
<defs> | |
<clipPath id="clip0"> | |
<rect width="711" height="159" fill="white"/> | |
</clipPath> | |
</defs> | |
</svg> | |
'''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker 2020 | |
/// Generic class to deal with svg_flutter package and graphx. | |
import 'dart:ui'; | |
import 'package:flutter_svg/flutter_svg.dart'; | |
import 'package:graphx/graphx.dart'; | |
/// Utility functions to work with flutter_svg. | |
/// copy and paste in your project. | |
class SvgUtils { | |
static Future<DrawableRoot> svgStringToSvgDrawable(String rawSvg) async { | |
return await svg.fromSvgString(rawSvg, rawSvg); | |
} | |
static Future<Picture> svgStringToPicutre(String rawSvg) async { | |
final svgRoot = await svg.fromSvgString(rawSvg, rawSvg); | |
return svgRoot.toPicture(); | |
} | |
static void svgStringToCanvas( | |
String rawSvg, | |
Canvas canvas, { | |
bool scaleCanvas = true, | |
bool clipCanvas = true, | |
Size scaleCanvasSize, | |
}) async { | |
final svgRoot = await svg.fromSvgString(rawSvg, rawSvg); | |
if (scaleCanvas) { | |
svgRoot.scaleCanvasToViewBox(canvas, scaleCanvasSize); | |
} | |
if (clipCanvas) { | |
svgRoot.clipCanvasToViewBox(canvas); | |
} | |
svgRoot.draw(canvas, null); | |
} | |
static Future<SvgData> svgDataFromString(String rawSvg) async { | |
final svgRoot = await svg.fromSvgString(rawSvg, rawSvg); | |
var obj = SvgData(); | |
obj.hasContent = svgRoot.hasDrawableContent; | |
obj.picture = svgRoot.toPicture(); | |
obj.viewBox = GxRect.fromNative(svgRoot.viewport.viewBoxRect); | |
obj.size = | |
GxRect(0, 0, svgRoot.viewport.size.width, svgRoot.viewport.size.height); | |
return obj; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment