<p>Canvas tutorial 01. There is some basic knowledge for you to learn.</p> <p>= 0.0; }</p> <p>*markup--em markup--pre-em](///the x coordinate whether or not is between two point we give. ***markup--strong markup--pre-strong](static **bool <em>markup--em markup--pre-em](_betweenPoint</em>(x, Point p1, Point p2) { **markup--strong markup--pre-strong](if **(p1.x > p2.x) { **markup--strong markup--pre-strong](return **x > p2.x && x p1.x && x p2.y) { **markup--strong markup--pre-strong](return **Point(p2.x, p2.y + r); } **markup--strong markup--pre-strong](else if **(p1.y p2.x) { **markup--strong markup--pre-strong](return **Point(p2.x + r, p2.y); } **markup--strong markup--pre-strong](else if **(p1.x Canvas tutorial 01. If you don’t know how to use, you should watch it before continuing. In our <code>**markup--strong markup--p-strong](void **paint(Canvas canvas, Size size)</code> function we will draw our shape.</p> <p>ps, double distance, Canvas canvas, paint) { **markup--strong markup--pre-strong](var **path = Path(); ps.add(ps[0]); ps.add(ps[1]); **markup--strong markup--pre-strong](var **p0 = LineInterCircle.<em>markup--em markup--pre-em](intersectionPoint</em>(ps[1], ps[0], distance); path.moveTo(p0.x, p0.y); **markup--strong markup--pre-strong](for **(int i = 0; i 1.0 && size.height > 1.0) { print(">1.9"); _sizeUtil.logicSize = size; } } _resizePoint(List list) { List l = List(); **markup--strong markup--pre-strong](for **(**markup--strong markup--pre-strong](var **p **markup--strong markup--pre-strong](in **list) { l.add(Point(_sizeUtil.getAxisX(p.x), _sizeUtil.getAxisY(p.y))); } **markup--strong markup--pre-strong](return **l; } list1 = [ Point(250.0, 0.0), Point(425.0, 75.0), Point(500.0, 250.0), Point(425.0, 425.0), Point(250.0, 500.0), Point(75.0, 426.0), Point(0.0, 250.0), Point(75.0, 75.0), ]; paint.color = RED_DARK1; _drawWithPoint(canvas, paint, list1); 1.0 && size.height > 1.0) { print(">1.9"); _sizeUtil.logicSize = size; } **markup--strong markup--pre-strong](var **paint = Paint() ..style = PaintingStyle.fill ..color = BLUE_NORMAL ..isAntiAlias = <strong>markup--strong markup--pre-strong](true</strong>; List list1 = [ Point(250.0, 0.0), Point(425.0, 75.0), Point(500.0, 250.0), Point(425.0, 425.0), Point(250.0, 500.0), Point(75.0, 426.0), Point(0.0, 250.0), Point(75.0, 75.0), ]; paint.color = RED_DARK1; _drawWithPoint(canvas, paint, list1); List list2 = [ Point(250.0, 53.0), Point(392.0, 108.0), Point(449.0, 250.0), Point(392.0, 390.0), Point(250.0, 448.0), Point(110.0, 390.0), Point(54.0, 250.0), Point(110.0, 108.0), ]; paint.color = RED_DARK2; _drawWithPoint(canvas, paint, list2, hasShadow: <strong>markup--strong markup--pre-strong](true</strong>);</p> <p>List list3 = [ Point(250.0, 100.0), Point(358.0, 143.0), Point(400.0, 250.0), Point(355.0, 355.0), Point(250.0, 400.0), Point(144.0, 357.0), Point(100.0, 250.0), Point(144.0, 144.0), ]; paint.color = RED_DARK3; _drawWithPoint(canvas, paint, list3, hasShadow: <strong>markup--strong markup--pre-strong](true</strong>);</p> <p>List list4 = [ Point(250.0, 150.0), Point(320.0, 180.0), Point(348.0, 250.0), Point(320.0, 320.0), Point(250.0, 348.0), Point(180.0, 320.0), Point(150.0, 250.0), Point(180.0, 180.0), ]; paint.color = RED_DARK4; _drawWithPoint(canvas, paint, list4, hasShadow: <strong>markup--strong markup--pre-strong](true</strong>);</p> <p>List list5 = [ Point(250.0, 202.0), Point(286.0, 217.0), Point(300.0, 250.0), Point(284.0, 284.0), Point(250.0, 300.0), Point(214.0, 282.0), Point(202.0, 250.0), Point(216.0, 216.0), ]; paint.color = RED_DARK5; _drawWithPoint(canvas, paint, list5, hasShadow: <strong>markup--strong markup--pre-strong](true</strong>);</p> <p>List listYellow = [ Point(110.0, 104.0), Point(250.0, 153.0), Point(358.0, 143.0), Point(450.0, 252.0), Point(369.0, 349.0), Point(250.0, 504.0), Point(140.0, 353.0), Point(100.0, 250.0), ]; paint.color = <em>markup--em markup--pre-em](YELLOW_NORMAL.withOpacity(0.5); _drawWithPoint(canvas, paint, listYellow); canvas.save(); canvas.restore</em>(); }<h3 name="dfe6graf graf--h3](Conclusion<p name="878egraf graf--p](In this article, we learn how to draw the round angle polygon.</p> <p><p name="dd5egraf graf--p](1. Consider the comply method, how to change the right angle to round angle. If we want to draw the regular polygon, it will a bit different, I will try to comply with this situation in the future.</p> <p><p name="6e8fgraf graf--p](2. Certain the two points near the angle, this is very important with our way.</p> <p><p name="ed77graf graf--p](3. draw the round angle, with three points and a distance we certain the angle.</p> <p><p name="605egraf graf--p](4. We use the points of a list to certain the round angle polygon</p> <p><p name="cfbbgraf graf--p](5. We handle the size between the logic size and design size, then we use it.</p> <p><h4 name="092dgraf graf--h4](The whole project is here, thanks for a star: [https://github.com/FlutterOpen/flutter-canvasdata-href="<a href=> https:="github.com="flutteropen="flutter-canvas"="</a><a href="https://github.com/FlutterOpen/flutter-canvas">https://github.com/FlutterOpen/flutter-canvas</a><h3 name="01dcgraf graf--h3](Creat by [https://www.facebook.com/flutteropen/data-href="<a href=> https:="www.facebook.com="flutteropen=""="</a><a href="https://www.facebook.com/flutteropen">https://www.facebook.com/flutteropen</a><p name="e484graf graf--p](— end —</p> <p><p name="3659graf graf--p](#Github Developer: [https://github.com/nb312/flutter-ui-nicedata-href="<a href=> https:="github.com="nb312="flutter-ui-nice"="</a><a href="https://github.com/nb312">https://github.com/nb312</a></p> <p><p name="8cd4graf graf--p](#Github Page: [https://www.facebook.com/flutteropendata-href="<a href=> https:="www.facebook.com="flutteropen"="</a><a href="https://www.facebook.com/flutteropen">https://www.facebook.com/flutteropen</a></p> <p><p name="bf58graf graf--p](#Facebook group: [https://www.facebook.com/groups/948618338674126/?source_id=2005989649497620data-href="<a href=""> https:="www.facebook.com="groups="948618338674126="?source_id="2005989649497620"</a><a href="https://www.facebook.com/groups/948618338674126/?source_id=2005989649497620">https://www.facebook.com/groups/948618338674126/?source_id=2005989649497620</a></p>
Canvas tutorial 02 | How to draw round angle polygon in the flutter?
This Article is posted by niebin312 at 1/3/2019 7:37:18 PM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags:
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter