Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SVG na ratunek nudnym UI
Search
Wojciech Warwas
June 23, 2022
Programming
0
42
SVG na ratunek nudnym UI
Prezentacja z meetupu 9.06.2022r na Flutter Silesia #3 w Katowicach
Wojciech Warwas
June 23, 2022
Tweet
Share
More Decks by Wojciech Warwas
See All by Wojciech Warwas
designSystemWW.pdf
obiwanzenobi
0
47
SVG na ratunek nudnym UI (FlutteredWrocław)
obiwanzenobi
0
16
Mapy on Flutter [PL]
obiwanzenobi
1
100
Other Decks in Programming
See All in Programming
Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition | AndroidMakers Paris
prof18
0
140
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
2
120
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
400
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.1k
Domain-Driven Transformation
hschwentner
2
1.5k
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
6
1.1k
Goのmultiple errorsについて (2024年4月版)
syumai
4
1.1k
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
410
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
1k
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
27
8.5k
"config" ってなんだ? / What is "config"?
okashoi
0
250
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
29
6.4k
Automating Front-end Workflow
addyosmani
1357
200k
Unsuck your backbone
ammeep
663
57k
Build The Right Thing And Hit Your Dates
maggiecrowley
25
2k
Designing with Data
zakiwarfel
96
4.8k
Product Roadmaps are Hard
iamctodd
45
9.7k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
How to train your dragon (web standard)
notwaldorf
74
5.2k
Web Components: a chance to create the future
zenorocha
306
41k
We Have a Design System, Now What?
morganepeng
44
6.8k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
Infographics Made Easy
chrislema
238
18k
Transcript
Wojciech Warwas SVG na ratunek nudnym UI
None
O czym NIE będziemy mówić
SVG? Zdjęcie dodane przez Laura Meinhardt: https://www.pexels.com/pl-pl/zdjecie/pozycja- fi gur-3678799/
SVG? Zdjęcie dodane przez Laura Meinhardt: https://www.pexels.com/pl-pl/zdjecie/pozycja- fi gur-3678799/
Co jest nie tak z SVG w Flutter?
None
None
None
Porównanie wydajności https://alibaba-cloud.medium.com/how-to-make-better-use-of-svg-in- fl utter-applications-964d38cb15a5 34 ms!
Czy możemy coś z tym zrobić?
Czy możemy coś z tym zrobić?
<svg height="80" width="300"> <g fill="none"> <path stroke="red" d="M5 20 l215
0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> </svg>
<svg height="80" width="300"> <g fill="none"> <path stroke="red" d="M5 20 l215
0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> </svg>
Przewaga paint - brak i/o - kontrola nad rysowaniem -
wydajność - możliwości dalszej optymalizacji / zmian
SVG to fl utter
- node.js CLI - generuje kod Flutter na podstawie SVG
- krzywe beziera - FILL oraz STROKE - path tracing svg-to- fl utter convert ~/path.svg SVG to fl utter
Rysowanie
Rysowanie
Rysowanie
Show me the code!
Show me the code!
Show me the code! <svg height="80" width="300"> <g fill="none"> <path
stroke="red" d="M5 20 l215 0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> </svg>
Show me the code! <svg height="80" width="300"> <g fill="none"> <path
stroke="red" d="M5 20 l215 0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> </svg> class MyPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { Path path = Path(); final Paint paint = Paint(); // Path 3 Stroke path = Path(); paint.color = const Color(0xff0000ff); paint.style = PaintingStyle.stroke; paint.strokeWidth = 1; path.moveTo(size.width * 0.02, size.height * 0.75); path.lineTo(size.width * 0.73, size.height * 0.75); canvas.drawPath(path, paint); } @override bool shouldRepaint(CustomPainter oldDelegate) { return true; } } // Path 1 Stroke paint.color = const Color(0xffff0000); paint.style = PaintingStyle.stroke; paint.strokeWidth = 1; path.moveTo(size.width * 0.02, size.height * 0.25); path.lineTo(size.width * 0.73, size.height * 0.25); canvas.drawPath(path, paint);
Show me the code! <svg height="80" width="300"> <g fill="none"> <path
stroke="red" d="M5 20 l215 0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> </svg> // Path 1 Stroke paint.color = const Color(0xffff0000); paint.style = PaintingStyle.stroke; paint.strokeWidth = 1; path.moveTo(size.width * 0.02, size.height * 0.25); path.lineTo(size.width * 0.73, size.height * 0.25); canvas.drawPath(path, paint);
Clip Photo by Chevanon Photography: https://www.pexels.com/photo/two-yellow-labrador-retriever-puppies-1108099/ Photo by Pixabay: https://www.pexels.com/photo/short-coated-black-and-brown-puppy-in-white-and-red-polka-dot-ceramic-mug-on-green-
fi eld-39317/ Photo by Denniz Futalan: https://www.pexels.com/photo/close-up-photo-of-a-small-short-coated-white-puppy-2523934/ Coming soon!!
Clip Photo by Denniz Futalan: https://www.pexels.com/photo/close-up- photo-of-a-small-short-coated-white-puppy-2523934/ Coming soon!!
Path tracing Gra fi ki oneline wykorzystane dzięki uprzejmości fi
rmy
Path tracing
Path tracing PathMetrics pathMetrics = path.computeMetrics(); for (PathMetric pathMetric in
pathMetrics) { Path extractPath = pathMetric.extractPath( 0.0, pathMetric.length * progress, ); canvas.drawPath(extractPath, paint); } svg-to- fl utter convert ~/path.svg --path-tracing svg-to- fl utter convert ~/path.svg —path-tracing-all
Dzięki za uwagę! Q&A Dodatkowe podziękowania: Kuba za pomysły Iteo
za one line Łukasz za cierpliwość https://github.com/ fl utter-clutter/svg-to- fl utter-path-converter https://github.com/obiwanzenobi/svg-to- fl utter-path-converter/tree/temp/fsilesia