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
52
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
56
SVG na ratunek nudnym UI (FlutteredWrocław)
obiwanzenobi
0
20
Mapy on Flutter [PL]
obiwanzenobi
1
120
Other Decks in Programming
See All in Programming
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
520
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
840
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
390
testingを眺める
matumoto
1
140
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
20
11k
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
500
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
140
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Go言語での実装を通して学ぶLLMファインチューニングの仕組み / fukuokago22-llm-peft
monochromegane
0
120
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Designing for Performance
lara
610
69k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Optimizing for Happiness
mojombo
379
70k
The Invisible Side of Design
smashingmag
301
51k
GraphQLとの向き合い方2022年版
quramy
49
14k
Facilitating Awesome Meetings
lara
55
6.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Making Projects Easy
brettharned
117
6.4k
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