<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Mintelligence - Medium]]></title>
        <description><![CDATA[Technical know how from M Intelligence team - Medium]]></description>
        <link>https://medium.com/mintelligence?source=rss----c96402b71706---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Mintelligence - Medium</title>
            <link>https://medium.com/mintelligence?source=rss----c96402b71706---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:28:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/mintelligence" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Descheduler ตัวช่วยการจัดการทรัพยากรของ node และ pod ให้ถูกต้อง !!!]]></title>
            <link>https://medium.com/mintelligence/descheduler-%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B8%A2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%A3%E0%B8%B1%E0%B8%9E%E0%B8%A2%E0%B8%B2%E0%B8%81%E0%B8%A3%E0%B8%82%E0%B8%AD%E0%B8%87-node-%E0%B9%81%E0%B8%A5%E0%B8%B0-pod-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%96%E0%B8%B9%E0%B8%81%E0%B8%95%E0%B9%89%E0%B8%AD%E0%B8%87-09a10ce4ec3d?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/09a10ce4ec3d</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[descheduler]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Tanapat Mangsakul]]></dc:creator>
            <pubDate>Fri, 31 Jan 2025 10:15:51 GMT</pubDate>
            <atom:updated>2025-01-31T10:15:51.053Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>บทความนี้เหมาะกับผู้อ่านที่มีความเข้าใจเกี่ยวกับ kubernetes เป็นอย่างดี อาจมีคำสั่ง ศัพท์และภาพที่ไม่เหมาะกับบุคคลทั่วไป devops ควรให้คำแนะนำอย่างใกล้ชิด</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dJIHKxwtQl0YfIFp" /></figure><p>คุณเป็นคนนึงที่เจอปัญหา pod ไม่ถูกกระจายไปแต่ละ node ในจำนวนที่ควรจะเป็นหรือไม่ ?</p><p>ถ้าใช่ ผมขอแสดงความยินดีด้วย <strong>คุณมาถูกทางแล้ว</strong> !!!</p><p>เพราะในบทความนี้ ผมจะสอนวิธีการกระจาย pod ให้มันไปหาที่อยู่ ที่ๆมันควรจะอยู่ เพื่อจัดสรรการใช้สรรพยากรอย่างถูกต้อง</p><p>ก่อนที่จะเริ่มบทความนี้ คุณควรศึกษาเรื่องของ node และ pod ให้เข้าใจเสียก่อน !!!</p><p>ก่อนอื่น เรามาดูปัญหาที่เกิดขึ้นก่อน เพื่อจะได้เห็นภาพตรงกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUc-AP71wmzgBI_VICObSA.png" /></figure><p>จากรูป จะสังเกตุได้ว่า ใน cluster ของผมนั้น มี nodes อยู่ 3 ตัว และ pods อยู่ 3 ตัว แต่ว่า pod แต่ละตัวดันไปกระจุกอยู่แค่ nodes เดียว</p><p>นั้นหมายความว่าเราได้เสีย cost ในการเปิด nodes ไปฟรีๆ นอกจากนั้น cpu หรือ memory ของ node ที่ pods ไปกระจุกอยู่นั้นก็อาจจะเกิดการ overload ก็เป็นได้</p><p>ซึ่งปัญหาแบบนี้ ส่วนใหญ่แล้วจะเกิดขึ้นเมื่อเราได้มีการ set image หรือทำการสร้างและลบ pod ใหม่</p><p>ส่วนวิธีแก้ก็ง่ายๆมากๆ ทุกท่านสามารถทำตามแบบ step by step ได้เลยครับ</p><p>ขั้นตอนแรก เราก็ทำการติดตั้ง <a href="https://github.com/kubernetes-sigs/descheduler">descheduler</a> ผ่าน <a href="https://helm.sh/docs/intro/install/">helm</a></p><pre>helm repo add descheduler https://kubernetes-sigs.github.io/descheduler/<br>helm install descheduler --namespace kube-system descheduler/descheduler</pre><p>หลังจากนั้น เราจะได้ Cron job และ Config map ที่ชื่อ descheduler มาอย่างละ 1 ตัว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwXAG5Y0kBhrBxHIpASmyQ.png" /></figure><p>ขั้นตอนต่อไป เราต้องเข้าไป config แต่ละตัวก่อน เริ่มจาก Cron job ก่อน</p><pre>kubectl edit cronjob descheduler -n kube-system</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTc5vtq5NN0PjNK2O2SINg.png" /><figcaption>จากตัวอย่าง เราจะให้ schedule ทำงานทุกๆ 2 นาที</figcaption></figure><p>จากนั้น เราต้องเข้าไปแก้ไข config map โดนที่เราแก้ไขในส่วนของ profiles ตามนี้</p><pre>kubectl edit configmap descheduler -n kube-system</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xKOg0-vOWdJduKECjlNlA.png" /><figcaption>ใช้ plugin RemovePodsViolateingTopologySpreadConstranint</figcaption></figure><p>ขั้นตอนสุดท้าย เราควรไปจัดการที่ deployment ของเราด้วย</p><pre>kubectl edit deployment nginx-1 -n default</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_HgxQ6hPzUt3fRCZ0v56Q.png" /><figcaption>เพิ่มในส่วนของ spec.spec.topologySpreadConstraints</figcaption></figure><p>ทีนี้ เราไปดูผลลัพธ์ที่เกิดขึ้นกันครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7nQDXS8E7aCUWrwWxE-Mw.png" /></figure><p>จากรูปก็จะเห็นได้ว่า ตัว pods ของเรานั้น จากที่เคยไปอยู่ใน node เดียว ก็ถูกกระจายออกไปอย่างเท่าๆกันเป็นที่เรียบร้อยแล้ว</p><p>สรุปหลักการทำงานสั้นๆง่ายๆของ descheduler นั่นก็คือ</p><blockquote>เป็น cron job ที่คอยเช็ค pod ว่า pod ได้อยู่ใน nodes ที่เราได้ทำการ config อยู่รึเปล่า ถ้าเกิด pod ไม่ได้อยู่ในที่ที่เราได้ทำการ configไว้ ก็จะทำการ terminate และ create ใหม่ เพื่อให้ตรงกับเป้าหมายที่เราตั้งไว้ เพื่อช่วยในการจัดการทรัพยากรของ cluster ให้ดียิ่งขึ้น</blockquote><p>นอกจากการกระจายให้เท่าๆกันแล้ว ยังมี config อีกหลากหลายรูปแบบ เช่น ตรวจสอบ cpu หรือ memory ก่อนที่จะเลือกที่อยู่ให้กับ pod หรืออื่นๆอีกมากมาย ทุกๆท่าน สามารถศึกษาเพิ่มเติมได้ ตามลิ้งค์ด้านล่างได้เลยครับ</p><p><strong>Reference</strong></p><ul><li><a href="https://github.com/kubernetes-sigs/descheduler">https://github.com/kubernetes-sigs/descheduler</a></li><li><a href="https://kubernetes.io/">https://kubernetes.io/</a></li><li><a href="https://helm.sh/">https://helm.sh/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09a10ce4ec3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/descheduler-%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B8%A2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%A3%E0%B8%B1%E0%B8%9E%E0%B8%A2%E0%B8%B2%E0%B8%81%E0%B8%A3%E0%B8%82%E0%B8%AD%E0%B8%87-node-%E0%B9%81%E0%B8%A5%E0%B8%B0-pod-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%96%E0%B8%B9%E0%B8%81%E0%B8%95%E0%B9%89%E0%B8%AD%E0%B8%87-09a10ce4ec3d">Descheduler ตัวช่วยการจัดการทรัพยากรของ node และ pod ให้ถูกต้อง !!!</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect X Tech Stack 2023 !!]]></title>
            <link>https://medium.com/mintelligence/connect-x-tech-stack-2023-8520816f104d?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/8520816f104d</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[tech-stack]]></category>
            <category><![CDATA[cdp]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <category><![CDATA[xconnect]]></category>
            <dc:creator><![CDATA[Tanapat Mangsakul]]></dc:creator>
            <pubDate>Fri, 31 Jan 2025 10:15:42 GMT</pubDate>
            <atom:updated>2025-01-31T10:15:42.162Z</atom:updated>
            <content:encoded><![CDATA[<h3>Connect X Tech Stack 2023 !!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Xt-maAzZFHyf84QERfj5g.jpeg" /><figcaption>https://www.connect-x.tech</figcaption></figure><p>สวัสดีพี่น้องชาว medium ทุกท่านนะครับ ณ เวลานี้ คงไม่มีใครไม่รู้จัก <a href="https://www.connect-x.tech/"><strong>Connect X CDP อันดับ 1 ของประเทศไทย</strong></a><strong> วั</strong>นนี้ถือเป็นวันที่พิเศษและตื่นเต้นสุดๆ เพราะทางทีมพัฒนา Connect X ได้มีการ sharing ในส่วนของ Tech Stack Connect X ว่าในปี 2023 ทางทีมพัฒนา ได้มีการเลือกใช้เครื่องไม้เครื่องมืออะไรกันบ้าง ถ้าพร้อมแล้วไปรับชมกันได้เลยครับบบบ</p><p>แต่เดี๋ยวก่อนนน…ก่อนที่ทุกท่านจะไปรับชม Tech Stack ก็ต้องมารู้กันก่อนว่าใน Connect X เนี่ย มันมี module อะไรกันบ้าง</p><ol><li><strong>CDP</strong></li></ol><p>สำหรับ module นี้เรียกได้ว่าเป็น back bone ของระบบเลยก็ว่าได้ เพราะเป็นส่วนที่คอยจัดการเรื่อง data ทั้งหมดของระบบ ไม่ว่าจะเป็น data ที่เกิดจากภายในระบบเอง หรือ data ที่เกิดจากการที่ลูกค้าได้มีการ import หรือ fetch api หรือไม่ว่าจะเป็น feature ที่ลูกค้าอยากจะ custom ให้ทางเราไปดึง data จากที่อื่นก็ตาม</p><p><strong>2. Marketing &amp; Automation</strong></p><p>ในส่วนนี้จะเป็นการที่นำ raw data จากระบบมา analyze เพื่อให้เกิดการโต้ตอบ (engagement) กลับไปหา customers ดังนั้นจึงต้องมีความรวดเร็ว ถูกต้อง และที่สำคัญ ต้องสามารถรับ load ได้ในเวลาอันสั้น (heavy spike) เพื่อให้ระบบสามารถใช้งานได้โดยที่ไม่เกิดข้อผิดพลาด</p><p><strong>3. Ads &amp; Web tracking</strong></p><p>ต้องบอกว่า transaction ของระบบ tracking ของเราต้องรองรับ load และปริมาณ request ค่อนข้างเยอะ เพราะว่าเป็นการ track users behavior ทั้งหมดเพื่อประมวลผล ดังนั้นเรื่อง scaling หรือ zero downtime ค่อนข้างจำเป็นมากๆ</p><p><strong>4. Engagement &amp; Ticket</strong></p><p>เรียกได้ว่าเป็น module ที่นิยมและตอบโจทย์ลูกค้าหลายเจ้ามากๆ ดังนั้นความเร็วและ realtime ต้องมาก่อน</p><p><strong>5. Order</strong></p><p>แน่นอนว่าถ้ามีเรื่องของ payment เข้ามาเกี่ยวข้อง เรื่องของ logging, back up, error handling, retry เป็นสิ่งที่ขาดไม่ได้ เพื่อให้แน่ใจ transaction ไม่ผิดเพี้ยน เพราะถ้าผิดแม้แต่บาทเดียว รู้ๆกันอยู่ หมี่เหลืองแน่ &gt;&lt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R9zELRCkykQZ73pgBNsDng.jpeg" /></figure><p>เป็นยังไงกันบ้างครับ สำหรับ Stack ที่ Connect X เลือกใช้ เรียกได้ว่าครบเครื่อง เพรียบพร้อม ตอบโจทย์ พร้อมเสิร์ฟสำหรับคุณลูกค้าหลายๆท่าน เพื่อให้ลูกค้าได้รับประสบการณ์ที่ดีที่สุด และงานที่ได้ตอบโจทย์ลูกค้ามากที่สุด</p><p>สุดท้ายและท้ายสุด หากเพื่อนๆกำลังมองหา Tech Stack และยังไม่แน่ใจว่าจะใช้ตัวไหนดี เพื่อนๆสามารถนำ Stack ข้างต้นไปใช้ใน Project ของเพื่อน และถ้าหากเกิดข้อสงสัยเพิ่มเติม เพื่อนๆสามารถคอมเม้นทิ้งไว้หรือมาแลกเปลี่ยนพูดคุยกันได้นะครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8520816f104d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/connect-x-tech-stack-2023-8520816f104d">Connect X Tech Stack 2023 !!</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การใช้งาน React Library ในการทำ Custom Preview รูปภาพ Full Screen เบื้องต้น]]></title>
            <link>https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-react-library-%E0%B9%83%E0%B8%99%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3-custom-preview-%E0%B8%A3%E0%B8%B9%E0%B8%9B%E0%B8%A0%E0%B8%B2%E0%B8%9E-full-screen-%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-863ec694c8e1?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/863ec694c8e1</guid>
            <category><![CDATA[react-libraries]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <category><![CDATA[full-screen-display]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Papat Peetawanik]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 08:01:03 GMT</pubDate>
            <atom:updated>2024-06-20T08:01:03.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJJ3YyExuyagjiHDc7qxfg.png" /></figure><p>สวัสดีครับ ผมขอแนะนำตัวก่อนนะครับ ผมบิ๊ก จาก บริษัท <strong>M Intelligence</strong> ปัจจุบันทำงานอยู่ในตำแหน่ง <strong>Front end developer</strong> อันนี้เป็นการเขียนบทความครั้งแรกของผม ผมอยากมาแชร์มุมมองในการใช้ Library React มาใช้ในชีวิตประจำวัน มันจะทำให้เพื่อนๆสามารถทำงานได้ รวดเร็ว และสะดวกมากขึ้น ผมขออธิบายเกี่ยวกับการใช้ Library เบื้องต้นนะครับ ว่ามันมีข้อดีข้อเสียยังไง ทำไมเพื่อนๆถึงต้องใช้ Library ในการทำงานในชีวิตประจำวันด้วย</p><p><strong>ใช้ Library ดีกว่าเขียนเองยังไง</strong> ?</p><p><strong>1.ประหยัดเวลา</strong> — การใช้ Library ช่วยลดเวลาในการพัฒนา โดยไม่ต้องเขียนโค้ดทุกอย่างเอง</p><p>2.<strong>ความเสถียร</strong> — Library ที่ได้รับการทดสอบมากๆ มีโอกาสมีความเสถียรมากขึ้น ยกตัวอย่าง เช่น ถ้าคนใช้ Library แล้วเกิดปัญหาจะมีการกลับไปแจ้งนักพัฒนาให้แก้ไข เพราะพอนักพัฒนาได้ feedback ในเชิงลบ(บัค) นักพัฒนาจะมีแก้ไขปัญหาในส่วนที่แจ้งมา แล้วอัพกลับไปให้เป็นเวอร์ชั่นใหม่ที่ทางนักพัฒนาแก้ไขมาแล้ว</p><p>3.<strong>ความยืดหยุ่น</strong> — สามารถใช้ Library หลายๆตัวได้เพื่อบรรลุฟังก์ชันที่ต้องการ</p><h4><strong>เป็นธรรมดาถ้ามีข้อดีก็ต้องมีข้อเสียควบคู่ไปด้วย</strong></h4><ol><li>ขนาด — บางครั้ง Library มีขนาดใหญ่ ซึ่งอาจทำให้มีความจำเป็นต้องโหลดไฟล์ที่ไม่จำเป็น</li><li>การปรับแต่ง — อาจมีข้อจำกัดในการปรับแต่ง Library ตามความต้องการของโปรเจกต์</li></ol><p>ผมเกริ่นเรื่อง Library มาพอสมควร วันนี้ผมเลยจะมาแนะนำ<strong> Library React อยู่ 2 ตัวครับ คือ ตัว react-full-screen กับ react-fit-to-viewport มาใช้ในการทำ Custom Preview รูปภาพให้เต็มหน้าจอ หรือ การกำหนดขอบเขตของหน้าจอได้ ตามที่เราต้องการ</strong></p><p>ก่อนอื่นเลย ผมจะขออธิบายการใช้งานเบื้องต้น ของ React-Full-Screen พร้อมตัวอย่างประกอบ</p><ol><li>ต้องติดตั้งตัว Library react-full-screen สักก่อนไม่งั้นเพื่อนๆจะไม่สามารถใช้งาน Library ตัวนี้ได้ครับ</li></ol><p><strong>มีวิธีการติดตั้งอยู่ 2 วิธี ( npm / yarn)</strong></p><p>React-full-screen , React-fit-to-viewport</p><pre>npm i react-full-screen<br>npm i react-fit-to-viewport</pre><p>or</p><pre>yarn add react-full-screen<br>yarn add react-fit-to-viewport</pre><p>2. วิธีดูว่า Library ตัวที่เราต้องการใช้ install เสร็จ ดูได้ที่ File package.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMiL32qMY86gLNBXaqtb1g.png" /></figure><p>3. พอติดตั้งตัว Library เสร็จ ผมจะมาสอนวิธีใช้ Library กัน ก่อนอื่นเลย เพื่อนๆต้อง import ตัว Library เข้ามาก่อน เพื่อให้จะได้รู้ว่าเราจะใช้ Library ตัวไหนในการทำงาน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyWcMkLNxlBkME_ylSySGg.png" /></figure><p>4. React สามารถใช้งานคู่กับ State ได้ พอเพื่อนๆ Import <strong>react-full-screen </strong>มาแล้ว เพื่อนๆจะสามารถใช้ Tag FullScreen ได้ Tag FullScreen เหมือน Component ตัวนึงที่ข้างในจะมี Tag Html ต่างๆ ที่ custom css มาให้เสร็จ เราก็แค่ประกาศ Tag (ที่บรรทัด 20) ข้างใน Tag FullScreen เพื่อนๆสามารถใส่ Tag Html ได้ปกติ รวมถึง State กับ css ก็สามารถใช้ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hkCJYH77FB2iSkqwfQ58tQ.gif" /></figure><p>5. พอเพื่อนๆทำ <strong>react-full-screen </strong>เสร็จแล้ว เมื่อเป็นการไม่เสียเวลา ผมจะเริ่ม Library ตัวที่สองกันเลย Library ตัวนี้มีชื่อว่า<strong> react-fit-to-viewport </strong>เพื่อนๆอาจจะสงสัยว่า Library ตัวนี้มีไว้ทำอะไร แต่ถ้าจะแปลตรงๆ viewport หมายความว่า เป็นพื้นที่ที่แสดงผลของเว็บไซต์บนหน้าจอของอุปกรณ์ สรุปก็คือ <strong>react-fit-to-viewport </strong>มันคือ Library ที่ช่วยให้เพื่อนๆสามารถ ฟิต ขนาดของขนาดหน้าจอได้เลยโดยไม่ตรงเขียน css เองนั้นเอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*stmQ5sXITd9ahMJ-Eqpj3A.png" /></figure><p>6. โค๊ดจะคล้าย <strong>react-full-screen </strong>คือตอนแรก ต้อง Import Library มาก่อน (บรรทัด 2) เสร็จแล้ว เพื่อนๆก็ใช้สามารถใช้งาน Library ได้ (บรรทัด 7) ถ้ามีเปิด tag (ต้องปิดเสมอนะ กลัวเพื่อนๆลืม) เพื่อนๆจะสังเกตว่า props ที่ใช้ของ Library จะมีทั้งหมด 4 ตัวหลักๆ ก็คือ</p><p><strong>1.width&lt;number&gt; ความกว้าง</strong></p><p><strong>2.height&lt;number&gt; ความสูง</strong></p><p><strong>3.maxZoom&lt;number&gt; ซูมได้สูงสุด 1.0–3.0</strong></p><p><strong>4.minZoom&lt;number&gt; ซูมได้ต่ำสุด 0.1-1.0</strong></p><p>แต่ props ที่ไม่บอกไว้ข้างต้นบางตัวก็สามารถใช้งานได้ เช่น className กับ style ไว้ใช้ตกแต่ง css กัน</p><blockquote><strong>สรุป</strong></blockquote><p>Library มีประโยชน์ครับ แต่ต้องเลือกใช้กับ project ตาม requirement ที่เหมาะสมครับ ไว้พบกันไหมครับ…</p><p><strong>แหล่งที่มา :</strong></p><p><a href="https://www.npmjs.com/package/react-full-screen">https://www.npmjs.com/package/react-full-screen</a></p><p><a href="https://react-fit-to-viewport.pomb.us/">https://react-fit-to-viewport.pomb.us/</a></p><p><a href="https://github.com/pomber/react-fit-to-viewport">https://github.com/pomber/react-fit-to-viewport</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=863ec694c8e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-react-library-%E0%B9%83%E0%B8%99%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3-custom-preview-%E0%B8%A3%E0%B8%B9%E0%B8%9B%E0%B8%A0%E0%B8%B2%E0%B8%9E-full-screen-%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-863ec694c8e1">การใช้งาน React Library ในการทำ Custom Preview รูปภาพ Full Screen เบื้องต้น</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การใช้งานเบื้องต้น ReactPrismEditor]]></title>
            <link>https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-reactprismeditor-d2ca2f436de0?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/d2ca2f436de0</guid>
            <category><![CDATA[libraries]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Papat Peetawanik]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 08:00:38 GMT</pubDate>
            <atom:updated>2024-06-20T08:00:37.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*Dl45K7xNtc45-nF1GEwT8g.png" /></figure><p>เนื่องจากผมมีการใช้งาน <strong>ReactPrismEditor</strong> ในโปรเจ็คที่ทำอยู่ ผมเลยอยากเขียนบทความสรุปขึ้น เพื่อให้เพื่อนๆ เข้าใจการใช้งาน <strong>ReactPrismEditor</strong> มากขึ้น ผมสรุปตามความเข้าใจของทางผมเอง ถ้าหากมีข้อผิดพลาดประการใด ของอภัยมาก ณ ที่นี้ด้วยครับ</p><p><strong>ทำความเข้าใจก่อนเลย ReactPrismEditor คืออะไร ?</strong></p><ul><li>ReactPrismEditor เป็นไลบรารีที่ถูกสร้างขึ้นบน React สำหรับการแสดงโค้ดอย่างสวยงามและมีสีสัน โดยใช้ PrismJS เป็นเครื่องมือในการ highlight โค้ดต่าง ๆ</li></ul><p><strong>วิธีการติดตั้ง ReactPrismEditor มีวิธีการติดตั้งอยู่ 2 วิธี ( npm / yarn)</strong></p><pre>npm install react-prism-editor</pre><p>or</p><pre>yarn add react-prism-editor</pre><h3>การใช้ ReactPrismEditor สั้นๆ แบบ Basic</h3><ul><li>ในการใช้ ReactPrismEditor คุณสามารถใส่โค้ดที่คุณต้องการแสดงลงไปใน value prop ของ ReactPrismEditor ได้อย่างง่ายดายๆ</li></ul><p><strong>รายละเอียด Props Value ต่างๆ ของ ReactPrismEditor</strong></p><ul><li><strong>readOnly &lt;String&gt; = อยู่ในโหมดอ่านเท่านั้น</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0mIWuNQ6J7714SCvcZU49w.gif" /></figure><ul><li><strong>language &lt;String&gt; = ภาษาที่ใช้ได้ เช่น</strong> json,javascript,jsx,tsx,typescript<br> html,vue,angular,css,sass,markup<br> java,php,csharp,c,cpp,sql,xml</li><li><strong>theme &lt;String&gt; = ธีมที่ใช้ได้ เช่น</strong> default, coy, dark, funky, okaidia, solarizedlight, tomorrow, twilight</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVXJXgx32yq6l0LY_mPUCw.gif" /></figure><ul><li><strong>code &lt;String&gt; = props value state</strong></li><li><strong>lineNumber &lt;Boolean&gt; = แสดงจำนวนบรรทัด</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKwE3YbyBeF4V_O0DeEvOw.gif" /></figure><ul><li><strong>clipboard &lt;Boolean&gt; = สามารถ Copy Clipboard ได้</strong></li><li><strong>changecode = (code) =</strong> <strong>จะทำงานก็ต่อเมื่อ มีการเปลี่ยนแปลงข้อความ</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdtVZrQH_liqHeiJFEpfqg.png" /></figure><h3><strong>สรุปการใช้ของ ReactPrismEditor</strong></h3><p><strong>ข้อดี</strong> = สามารถใช้งานได้ง่าย โดยแค่การ Install สร้าง Component แล้วส่งค่า props value ที่ต้องการ</p><p><strong>ข้อเสีย</strong> = ถ้าอยากได้อะไรใหม่ๆที่ทาง Lib ไม่มีมาให้ จะ Custom ค่อนข้างลำบาก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IbXhFcJrnSU7pDan4L0Cng.png" /></figure><p>แหล่งที่มา : <a href="https://lumia2046.github.io/react-prism-editor/">react-prism-editor</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2ca2f436de0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-reactprismeditor-d2ca2f436de0">การใช้งานเบื้องต้น ReactPrismEditor</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Widget Test เบื้องต้น]]></title>
            <link>https://medium.com/mintelligence/flutter-widget-test-%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-0d4afafe20f4?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/0d4afafe20f4</guid>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Darthnot]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 08:56:38 GMT</pubDate>
            <atom:updated>2024-06-18T08:56:38.156Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*10RECXGTH5NyaeBg5yD1pw.png" /></figure><p>ใน Flutter จะมี Library ที่ใช้สำหรับ <a href="https://docs.flutter.dev/testing/overview">Automate test</a> โดยจะมีอยู่ 3 ระดับ Integration Test, Widget Test, Unit Test ซึ่งทั้ง 3 แบบจะมีลักษณะและข้อดีข้อเสียแตกต่างกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrzor-g4a3gbG-jBFyNqFg.png" /></figure><p>ในบทความนี้จะพูดถึง Widget Test จะเป็นการทดสอบ UI, การทำงานโต้ตอบ ใน Widget นั้นๆ</p><ol><li>เริ่มจากเพิ่ม flutter_test ใน dev_dependencies (อาจจะเพิ่มการเพิ่มอัตโนมัติตอนสร้างโปรเจคแล้ว)</li></ol><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  cupertino_icons: ^1.0.6<br><br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter<br>  flutter_lints: ^3.0.0</pre><p>2. ทำการสร้าง Widget ในโปรเจค</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*Wb3lKdwnvpB-QiZ_gOTEvg.png" /></figure><p>ณ ตัวอย่างนี้จะมี 2 Widget คือ counter, header</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/header.dart&#39;;<br><br>class Counter extends StatefulWidget {<br>  const Counter({super.key, required this.title});<br><br>  final String title;<br><br>  @override<br>  State&lt;Counter&gt; createState() =&gt; _MyHomePageState();<br>}<br><br>class _MyHomePageState extends State&lt;Counter&gt; {<br>  int _counter = 0;<br><br>  void _incrementCounter() {<br>    setState(() {<br>      _counter++;<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        backgroundColor: Theme.of(context).colorScheme.inversePrimary,<br>        title: Header(text: widget.title),<br>      ),<br>      body: Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: &lt;Widget&gt;[<br>            const Text(<br>              &#39;You have pushed the button this many times:&#39;,<br>            ),<br>            Text(<br>              &#39;$_counter&#39;,<br>              style: Theme.of(context).textTheme.headlineMedium,<br>            ),<br>          ],<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: _incrementCounter,<br>        tooltip: &#39;Increment&#39;,<br>        child: const Icon(Icons.add),<br>      ), // This trailing comma makes auto-formatting nicer for build methods.<br>    );<br>  }<br>}</pre><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class Header extends StatelessWidget {<br>  String text;<br>  Header({super.key, required this.text});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Container(<br>      child: Text(<br>        text,<br>        style: const TextStyle(color: Colors.red),<br>      ),<br>    );<br>  }<br>}</pre><p>โดยแอพจะมีหน้าประมานนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*IBKn-11eE-elz8iDatWi0w.png" /></figure><p>3. เพิ่ม WidgetTester ที่ test/test_widget.dart</p><pre>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/counter.dart&#39;;<br><br>void main() {<br>  testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>    await tester.pumpWidget(const MaterialApp(<br>      home: Scaffold(<br>        body: Counter(<br>          title: &#39;Title1&#39;,<br>        ),<br>      ),<br>    ));<br>  });<br>}</pre><p>4. ค้นหา Element ต่างๆใน Widget โดยใช้ Finder</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/counter.dart&#39;;<br><br>void main() {<br>  testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>    await tester.pumpWidget(const MaterialApp(<br>      home: Scaffold(<br>        body: Counter(<br>          title: &#39;Title1&#39;,<br>        ),<br>      ),<br>    ));<br><br>    Finder zeroText = find.text(&#39;0&#39;);<br>    Finder oneText = find.text(&#39;1&#39;);<br>  });<br>}</pre><p>5. ตรวจสอบ Element ที่ค้นหาจากข้อ 4 โดยใช้ Matcher</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/counter.dart&#39;;<br><br>void main() {<br>  testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>    await tester.pumpWidget(const MaterialApp(<br>      home: Scaffold(<br>        body: Counter(<br>          title: &#39;Title1&#39;,<br>        ),<br>      ),<br>    ));<br><br>    Finder zeroText = find.text(&#39;0&#39;);<br>    Finder oneText = find.text(&#39;1&#39;);<br><br>    // Verify that our counter starts at 0.<br>    expect(zeroText, findsOneWidget);<br>    expect(oneText, findsNothing);<br>  });<br>}</pre><p>กดรันจากไอคอนรันเทสหรือใช้ flutter test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*y7erHHPnJR_3EsKT63qcFg.png" /></figure><p>จากนั้นจะเพิ่มการกดปุ่มแล้ว Match อีกที</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/counter.dart&#39;;<br><br>void main() {<br>  testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>    await tester.pumpWidget(const MaterialApp(<br>      home: Scaffold(<br>        body: Counter(<br>          title: &#39;Title1&#39;,<br>        ),<br>      ),<br>    ));<br><br>    Finder zeroText = find.text(&#39;0&#39;);<br>    Finder oneText = find.text(&#39;1&#39;);<br><br>    // Verify that our counter starts at 0.<br>    expect(zeroText, findsOneWidget);<br>    expect(oneText, findsNothing);<br><br>    // Tap the &#39;+&#39; icon and trigger a frame.<br>    await tester.tap(find.byIcon(Icons.add));<br>    await tester.pump();<br><br>    // Verify that our counter has incremented.<br>    expect(zeroText, findsOneWidget);<br>  });<br>}</pre><p>จากโค้ดด้านบนจะเทสไม่ผ่าน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZsRqgggy2LqFKcWTbA04Q.png" /></figure><p>เพราะหลังจากสั่งกดปุ่มเลขที่แสดงบนแอพจะแสดงเป็น 1 จึง Match ไม่เจอ ต้องเลี่ยนเป็นแบบภาพด้านล่างก็จะผ่าน</p><pre>testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>  await tester.pumpWidget(const MaterialApp(<br>    home: Scaffold(<br>      body: Counter(<br>        title: &#39;Title1&#39;,<br>      ),<br>    ),<br>  ));<br><br>  Finder zeroText = find.text(&#39;0&#39;);<br>  Finder oneText = find.text(&#39;1&#39;);<br><br>  // Verify that our counter starts at 0.<br>  expect(zeroText, findsOneWidget);<br>  expect(oneText, findsNothing);<br><br>  // Tap the &#39;+&#39; icon and trigger a frame.<br>  await tester.tap(find.byIcon(Icons.add));<br>  await tester.pump();<br><br>  // Verify that our counter has incremented.<br>  expect(zeroText, findsNothing);<br>  expect(oneText, findsOneWidget);<br>});</pre><p>โดย <a href="https://docs.flutter.dev/cookbook/testing/widget/introduction#additional-matchers">Matcher</a> จะมีหลายแบบให้ใช้</p><ul><li>หลังจากนี้จะเป็นการเพิ่ม Test Case หลายๆ Case หรือเพิ่ม Matcher หลายๆอันตามต้องการโดยการใช้ group</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_test/flutter_test.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/counter.dart&#39;;<br>import &#39;package:flutter_test_decendency/src/widgets/header.dart&#39;;<br><br>void main() {<br>  group(&#39;Counter Widget&#39;, () {<br>    late Widget testWidget;<br><br>    setUp(() {<br>      testWidget = const MaterialApp(<br>        home: Scaffold(<br>          body: Counter(<br>            title: &#39;Title1&#39;,<br>          ),<br>        ),<br>      );<br>    });<br><br>    testWidgets(&#39;Check initial wording&#39;, (WidgetTester tester) async {<br>      await tester.pumpWidget(testWidget);<br><br>      Finder text = find.text(&#39;You have pushed the button this many times:&#39;);<br><br>      expect(text, findsOneWidget);<br>    });<br><br>    testWidgets(&#39;Check increase button&#39;, (WidgetTester tester) async {<br>      await tester.pumpWidget(testWidget);<br><br>      final iconFinder = find.byType(Icon);<br>      expect(iconFinder, findsOneWidget);<br><br>      final iconSize = tester.getSize(iconFinder);<br>      expect(iconSize.width, 20.0);<br>      expect(iconSize.height, 20.0);<br>    });<br><br>    testWidgets(&#39;Counter increments smoke test&#39;, (WidgetTester tester) async {<br>      await tester.pumpWidget(testWidget);<br><br>      Finder zeroText = find.text(&#39;0&#39;);<br>      Finder oneText = find.text(&#39;1&#39;);<br><br>      // Verify that our counter starts at 0.<br>      expect(zeroText, findsOneWidget);<br>      expect(oneText, findsNothing);<br><br>      // Tap the &#39;+&#39; icon and trigger a frame.<br>      await tester.tap(find.byIcon(Icons.add));<br>      await tester.pump();<br><br>      // Verify that our counter has incremented.<br>      expect(zeroText, findsNothing);<br>      expect(oneText, findsOneWidget);<br>    });<br>  });<br><br>  group(&#39;Header Widget&#39;, () {<br>    late Widget testWidget;<br><br>    setUp(() {<br>      testWidget = MaterialApp(<br>        home: Scaffold(<br>            body: Header(<br>          text: &#39;title1&#39;,<br>        )),<br>      );<br>    });<br><br>    testWidgets(&#39;Check text display&#39;, (WidgetTester tester) async {<br>      await tester.pumpWidget(testWidget);<br>      Finder text = find.text(&#39;title1&#39;);<br>      expect(text, findsOneWidget);<br>    });<br><br>    testWidgets(&#39;Check text color&#39;, (WidgetTester tester) async {<br>      await tester.pumpWidget(testWidget);<br>      Finder text = find.text(&#39;title1&#39;);<br>      expect(text, findsOneWidget);<br>      final textWidget = tester.widget&lt;Text&gt;(text);<br>      expect(textWidget.style?.color, Colors.red);<br>    });<br>  });<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*nLCtczeZd-e-qW8ChMQQQA.png" /></figure><ul><li>แนะนำในการสร้าง Widget แต่ละอันให้เริ่มจากการสร้าง Widget สำหรับ Test ไว้ก่อนเลยจะได้ไม่ลืม</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d4afafe20f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/flutter-widget-test-%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99-0d4afafe20f4">Flutter Widget Test เบื้องต้น</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ใช้ Github Repository ติดตั้ง Dependency ส่วนตัว]]></title>
            <link>https://medium.com/mintelligence/%E0%B9%83%E0%B8%8A%E0%B9%89-github-repository-%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87-dependency-%E0%B8%AA%E0%B9%88%E0%B8%A7%E0%B8%99%E0%B8%95%E0%B8%B1%E0%B8%A7-680b5b852798?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/680b5b852798</guid>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Darthnot]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 08:56:21 GMT</pubDate>
            <atom:updated>2024-06-18T08:56:21.356Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*10RECXGTH5NyaeBg5yD1pw.png" /></figure><p>ในแต่ละโปรเจคจะมีการใช้ Dependency มากมายเพื่ออำนวยความสะดวกในการพัฒนาแอพพิเคชั่น ซึ่งบาง Dependency อาจจะไม่ได้ใช้ผลลัพธ์ที่เราต้องการ จะให้เขียนใหม่ตั้งแต่คนก็เสียเวลาหรือบางครั้งอาจจะมีการชนกันของเวอร์ชั่น Dependency</p><p>In Flutter Example</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  cupertino_icons: ^1.0.6<br>  path_provider: ^2.1.0<br>  flick_video_player: ^0.6.0<br>  package_info_plus: ^4.1.0<br>  file_picker: ^5.2.10<br><br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter<br>  flutter_lints: ^3.0.0</pre><p>จาก Dependency ข้างบนจะติดตั้งไม่ผ่านเพราะ</p><pre>Resolving dependencies...<br>Because wakelock_windows &gt;=0.2.1 depends on win32 ^3.0.0 and wakelock_windows &lt;0.2.1 depends on win32 ^2.0.0, every version of wakelock_windows requires win32 ^2.0.0 or ^3.0.0.<br>And because package_info_plus &gt;=4.0.1 depends on win32 &gt;=4.0.0 &lt;6.0.0, package_info_plus &gt;=4.0.1 is incompatible with wakelock_windows.<br>And because flick_video_player &gt;=0.6.0 &lt;0.8.0 depends on wakelock ^0.6.2 which depends on wakelock_windows ^0.2.0, package_info_plus &gt;=4.0.1 is incompatible with flick_video_player &gt;=0.6.0 &lt;0.8.0.<br>So, because flutter_test_decendency depends on both flick_video_player ^0.6.0 and package_info_plus ^4.1.0, version solving failed.</pre><p>มีการชนกันของเวอร์ชัน wakelock, win32 ทำให้ไม่สามารถติดตั้งได้</p><p>จริงๆ มีวิธีแก้ควรจะแก้ไขคือรายงานไปที่เจ้าของ Repo ให้มีการอัพเดทเวอร์ชันแต่หลายๆครั้งเจ้าของ Repo ไม่ว่างแก้ให้หรือแก้ก็ใช้เวลานาน</p><p>วิธีที่แนะนำคือ Fork Repository ออกมาแก้ไขหรือถ้าโชคดีอาจจะมีคนที่เจอปัญหาเดียวกันแก้ให้ ซึ้งเรามาสามารถนำ Repository นั้นมาทำการติดตั้งได้โดยตรง</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  cupertino_icons: ^1.0.6<br>  path_provider: ^2.1.0<br>  flick_video_player:<br>    git: https://github.com/h1amza/flick-video-player.git<br>  package_info_plus: ^4.1.0<br>  file_picker: ^5.2.10<br><br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter<br>  flutter_lints: ^3.0.0</pre><p>จะเห็นว่าเราสามารถใช้ Repository link ในการติดตั้งได้โดยตรง</p><pre>Got dependencies!<br>12 packages have newer versions incompatible with dependency constraints.<br>Try `flutter pub outdated` for more information.</pre><p>สามารถใช้วิธีนี้ใน Node ได้เช่นกัน : <a href="https://docs.npmjs.com/cli/v8/configuring-npm/package-json#git-urls-as-dependencies">Link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=680b5b852798" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B9%83%E0%B8%8A%E0%B9%89-github-repository-%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87-dependency-%E0%B8%AA%E0%B9%88%E0%B8%A7%E0%B8%99%E0%B8%95%E0%B8%B1%E0%B8%A7-680b5b852798">ใช้ Github Repository ติดตั้ง Dependency ส่วนตัว</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ทำ Custom hooks ใช้งานร่วมกับ onSnapshot (Cloud Firestore)]]></title>
            <link>https://medium.com/mintelligence/%E0%B8%97%E0%B8%B3-custom-hooks-%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%A3%E0%B9%88%E0%B8%A7%E0%B8%A1%E0%B8%81%E0%B8%B1%E0%B8%9A-onsnapshot-cloud-firestore-87710cfa8edb?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/87710cfa8edb</guid>
            <category><![CDATA[m-intelligence]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[google-firestore]]></category>
            <dc:creator><![CDATA[Moo Thanathorn]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 03:51:03 GMT</pubDate>
            <atom:updated>2024-06-18T03:51:03.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3PoEQ5PUC2RlnjzfAdx99w.jpeg" /></figure><p>เนื่องจากในโปรเจคที่ผมมีส่วนร่วม มีการใช้งาน React กับ Cloud firestore และต้องการแสดงผลแบบ Realtime นั้นต้องอาศัยฟังก์ชัน onSnapshot() ในการรับข้อมูลแบบทันที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*daKBBF42ihB3h42gqEzVzA.png" /><figcaption>credit : <a href="https://firebase.google.com/docs/firestore/query-data/listen?authuser=1">https://firebase.google.com/docs/firestore/query-data/listen?authuser=1</a></figcaption></figure><p>ตัว onSnapshot นั้นสามารถบอกลักษณะของ Change ที่เกิดขึ้นได้ว่าเป็นการเปลี่ยนแปลงข้อมูลชนิดใด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sztC2RpTm5KCNXUA3PbhmA.png" /><figcaption>credit : <a href="https://firebase.google.com/docs/firestore/query-data/listen?authuser=1#view_changes_between_snapshots">https://firebase.google.com/docs/firestore/query-data/listen?authuser=1#view_changes_between_snapshots</a></figcaption></figure><p>การนำมาใช้ร่วมกับ React Hooks จะต้องทำเป็น Custom hooks ขึ้นมาโดยใช้ useState เป็นตัวไว้คอยเก็บค่า isLoading ไว้ใช้กับ loader , data ใช้เก็บข้อมูลที่มากจาก firestore และ error ส่วน useEffect นำมาใช้คล้ายๆกับ lifecycle hook componentDidmount() เมื่อเรียกใช้ onSnapshot จะเป็นการ subscribe รอการ callback อยู่ตลอดเวลา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YCnFy8gFtvvrtncCnFQj8A.png" /></figure><p>เมื่อเราอยากจะ unsubscribe ก็สามารถทำได้โดย สร้างตัวแปร unsub มาเก็บฟังก์ชัน onSnapshot ของเราตรงบรรทัดที่ 15 จากนั้น ไปเรียกใช้ใน clean up ฟังก์ชันของ useEffect</p><p>*** ผมลองใช้วิธีนี้แต่ไม่ทราบเหมือนกันว่าทำไมมันไม่ unsubscribe ให้ ถ้าเพื่อนๆมีวิธีที่ดีกว่าแนะนำกันมาได้นะครับ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13f7fc25423ac00290124b226ba4da4a/href">https://medium.com/media/13f7fc25423ac00290124b226ba4da4a/href</a></iframe><p>สามารถอ่านเพิ่มเติ่มได้ที่ : <a href="https://medium.com/firebasethailand/%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%A1%E0%B8%82%E0%B9%89%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%9A-firebase-cloud-firestore-%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A%E0%B8%90%E0%B8%B2%E0%B8%99%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88%E0%B8%A5%E0%B9%88%E0%B8%B2%E0%B8%AA%E0%B8%B8%E0%B8%94%E0%B8%88%E0%B8%B2%E0%B8%81-firebase-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1-d001e43e2be7">https://medium.com/firebasethailand/%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%A1%E0%B8%82%E0%B9%89%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%9A-firebase-cloud-firestore-%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A%E0%B8%90%E0%B8%B2%E0%B8%99%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88%E0%B8%A5%E0%B9%88%E0%B8%B2%E0%B8%AA%E0%B8%B8%E0%B8%94%E0%B8%88%E0%B8%B2%E0%B8%81-firebase-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1-d001e43e2be7</a></p><ul><li>*****หลังจากที่ได้เขียนบทความนี้ ผมก็เจอ lib firebase react hook จากทาง <a href="https://github.com/CSFrequency/react-firebase-hooks/tree/master/firestore#usedocumentdata">CSFrequency</a> ทำขึ้นมา หากสนใจก็ลองใช้ดูนะครับ</li><li><a href="https://github.com/CSFrequency/react-firebase-hooks/tree/master/firestore#usedocumentdata">https://github.com/CSFrequency/react-firebase-hooks/tree/master/firestore#usedocumentdata</a></li></ul><p><a href="https://firebase.google.com/docs/firestore/query-data/listen?authuser=1">Get realtime updates with Cloud Firestore | Firebase</a></p><p><a href="https://reactjs.org/docs/hooks-effect.html">https://reactjs.org/docs/hooks-effect.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87710cfa8edb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B8%97%E0%B8%B3-custom-hooks-%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%A3%E0%B9%88%E0%B8%A7%E0%B8%A1%E0%B8%81%E0%B8%B1%E0%B8%9A-onsnapshot-cloud-firestore-87710cfa8edb">ทำ Custom hooks ใช้งานร่วมกับ onSnapshot (Cloud Firestore)</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การใช้ UseImperativeHandle ฉบับมือใหม่พร้อมตัวอย่างง่ายๆ]]></title>
            <link>https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-useimperativehandle-%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88%E0%B8%9E%E0%B8%A3%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86-c239778cf4e1?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/c239778cf4e1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[useimperativehandle]]></category>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Pattarayut Petcharat]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 03:50:55 GMT</pubDate>
            <atom:updated>2024-06-18T03:50:55.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*r07VTNdy4bh0PXdnLl1jxg.png" /></figure><p>ขอบอกว่าผมย้ายสายมาจาก Php(Laravel) มาจับ React พึ่งเริ่มเรียนรู้เป็นมือใหม่ป้ายแดงของแทร่</p><p>*เนื้อหานี้เป็นการสรุปตามความเข้าใจของผมเอง ถ้าหากมีการผิดพลาด ผมต้องขออภัยอย่างสูงครับ</p><p>ตัว UseImperativeHandle สรุปแบบสั้นๆ คือ hook ตัวหนึ่งที่ไว้ใช้ส่ง function หรือ อะไรก็แล้วแต่ ฯลฯ จาก Child Component(ลูก) ไป Parent Component (แม่)ได้ ซึ่งปกติ เวลาเราส่งต้องส่ง Props จาก Component แม่ไปหาลูกเท่านั้น โดยใชวิธีการ Callback Function</p><blockquote><strong>ตัวอย่างการใช้งาน</strong></blockquote><blockquote>**ผมสร้างสถานการณ์ตัวอย่างขึ้นมาเป็นการเพิ่มและลบ input ชื่อ-นามสกุล ประวัติส่วนตัวแบบง่ายๆ</blockquote><p>โดยผมสร้าง ขึ้นมา 2 ไฟล์มี Parent , Child Component ตามรูปภาพด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*rlrJeiwS9QgpKgmPRRy__w.png" /><figcaption>Parent Component</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eJwbFLzOPKMsDlDWlZxmRg.png" /><figcaption>Child Component</figcaption></figure><p>ซึ่งจะมีหน้าตาแบบนี้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*C58kPh2HRwvnNvJw6RVy-A.png" /><figcaption>ภาพการแสดงผล</figcaption></figure><p>โดยจะเห็นได้ว่า ในไฟล์ Parent Component(รูปภาพที่ 1) เรามีการ import Component ที่ชื่อว่า RenderData เข้ามาเป็น Child Component(รูปภาพที่ 2) มีฟังก์ชั่นที่ชื่อ onAddItem และ onDeleteItemAll อยู่ใน Component นี้ด้วย <br>โดยฟังก์ชั่นที่ชื่อ onAddItem จะอยู่ที่ button เพิ่มรายชื่อ ทำหน้าที่เป็นการ Update State ที่ชื่อว่า DataName Push Array เพิ่มเข้าไปทีละ 1 ตามวิดีโอด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*MtiocWZk_r_2SaWJAjshlA.gif" /><figcaption>ตัวอย่างการทำงานของฟังก์ชั่น onAddItem</figcaption></figure><p>และ ฟังก์ชั่น onDeleteItemAll จะทำหน้าที่ set State ให้เป็น Array เปล่าเปรียบเสมือนเป็นการลบข้อมูลทั้งหมดแล้ว</p><p>ทีนี้ถ้าเราอยากเอา ฟังก์ชั่น onDeleteItemAll ไปใช้ใน Parent Component(รูปภาพที่ 1) ละจะส่งไปยังไง ?</p><p>คำตอบก็ใช้ UseImperativeHandle ไงแหละ</p><p>วิธีใช้เราจำเป็นต้อง import forwardRef และ useImperativeHandle ก่อน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AAd7A6RqZ658ynr5KIZ_Wg.png" /><figcaption>เพิ่ม forwardRef และ useImperativeHandle ใน Child Component(รูปภาพที่ 2)</figcaption></figure><p>เราต้องรับ ref เข้ามาใน Component ด้วยจากนั้น เราเรียกใช้ useImperativeHandle โดยต้องรับ ref และ callback function จากนั้นให้เขียน function ที่ต้องการจะทำงานให้กับตัว Parent Component(รูปภาพที่ 1) ในที่นี้เราเขียนฟังก์ชั่น onDeleteItemAllHandle เพื่อเรียกใช้ onDeleteItemAll ใน Child Component(รูปภาพที่ 2) ตามรูปด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAKxLns29vyiOdBsX7cWDA.png" /><figcaption>ภาพแสดงการเรียกใช้ useImperativeHandle ใน Child Component</figcaption></figure><p>ทีนี้ให้เรามา import useRef ที่ Parent Component(รูปภาพที่ 1) และประกาศการเรียกใช้ในที่มีชื่อว่า ChildRef และเพิ่มปุ่มลบข้อมูลทั้งหมด และเรียกใช้ฟังก์ชั่น onDeleteItemAllHandle ผ่านตัว ref ตามรูปด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6NfqPWk3Q3znzhfZOsIC4Q.png" /><figcaption>ภาพแสดงการเรียกใช้ onDeleteItemAllHandle ใน Parent Component</figcaption></figure><p>ซึ่งผลลัพธ์จะได้ตามวิดีโอด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*og3ZmDaxpI9Si2NOv-I7AQ.gif" /><figcaption>ภาพแสดงการเรียกใช้ฟังก์ชั่น onDeleteItemAllHandle</figcaption></figure><p>สุดท้ายนี้หวังว่าบทความนี้จะมีประโยชน์ กับทุกคนที่เข้ามาอ่าน ไม่มากก็น้อยนะครับ หากผิดพลาดประการใด ขออภัยด้วยครับ</p><p>ขอบคุณครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c239778cf4e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-useimperativehandle-%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B9%83%E0%B8%AB%E0%B8%A1%E0%B9%88%E0%B8%9E%E0%B8%A3%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86-c239778cf4e1">การใช้ UseImperativeHandle ฉบับมือใหม่พร้อมตัวอย่างง่ายๆ</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Flutter] ทำ Custom Widget โดยการ Override]]></title>
            <link>https://medium.com/mintelligence/flutter-%E0%B8%97%E0%B8%B3-custom-widget-%E0%B9%82%E0%B8%94%E0%B8%A2%E0%B8%81%E0%B8%B2%E0%B8%A3-override-8a9d7e83aa81?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/8a9d7e83aa81</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[widgets-in-flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <dc:creator><![CDATA[Moo Thanathorn]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 03:50:47 GMT</pubDate>
            <atom:updated>2024-06-18T03:50:47.784Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Flutter] ทำ Custom Widgetโดยการ Override</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A37rmWIZMsSZ_GI2xwRgJw.png" /></figure><p>อย่างที่ทราบกัน Flutter เป็น Cross platform app development framework จึงมี component มาให้ใช้สะดวกสบายมาก อย่าง material (Andorid style) หรือ cupertino (Ios style) แต่ถ้าเราอยากได้หน้าตาเฉพาะก็สามารถทำได้</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(const MainApp());<br>}<br><br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>          appBar: AppBar(<br>            leading: const Icon(Icons.abc),<br>            title: const Text(&quot;Play Gorund&quot;, textAlign: TextAlign.center),<br>          ),<br>          body: ListView.builder(<br>              itemCount: 20,<br>              itemBuilder: (context, index) {<br>                return ExpansionTile(<br>                  title: Text(&quot;Expansion Tile ${index + 1}&quot;),<br>                  children: [<br>                    Container(<br>                      padding: const EdgeInsets.all(10),<br>                      child: Text(&quot;Children ${index + 1}&quot;),<br>                    ),<br>                  ],<br>                );<br>              })),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBKH3_gZ3DnebOWGYZXbBg.png" /></figure><p>ผมจะใช้ class ExpansionTile เป็นตัวอย่าง จากด้านบนธรรมดาจะหน้าตาตามภาพ และ เราสามารถใส่ props ตกแต่งหน้าตาตามที่เราต้องการจะได้แบบนี้</p><p><a href="https://api.flutter.dev/flutter/material/ExpansionTile-class.html#material.ExpansionTile.1">ExpansionTile class</a></p><pre><br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    Widget content = Container(<br>      padding: const EdgeInsets.all(10),<br>      child: const Text(&quot;Content Content Content&quot;),<br>    );<br><br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(<br>          leading: const Icon(Icons.abc),<br>          title: const Text(&quot;Play Gorund&quot;, textAlign: TextAlign.center),<br>        ),<br>        body: ListView(<br>          children: [<br>            ExpansionTile(<br>              // เพิ่ม icon ด้านหน้า<br>              leading: const Icon(<br>                Icons.warning_amber,<br>                size: 24,<br>                color: Colors.amber,<br>              ),<br>              // เพิ่มสี ปรับขนาด และความหนาของ title<br>              title: const Text(<br>                &quot;Waring&quot;,<br>                style: TextStyle(<br>                  fontSize: 18,<br>                  fontWeight: FontWeight.w700,<br>                  color: Colors.amber,<br>                ),<br>              ),<br>              // เพิ่มสี bg ตอน expanded<br>              backgroundColor: Colors.amber[50],<br>              // เพิ่มสี icon ตอน expanded<br>              iconColor: Colors.amber,<br>              // ลบ border<br>              shape: const Border.fromBorderSide(BorderSide.none),<br>              // เพิ่ม title padding<br>              tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>              // เพิ่ม children data<br>              children: [content],<br>            ),<br>            ExpansionTile(<br>              leading: const Icon(<br>                Icons.check_circle_outline_outlined,<br>                size: 24,<br>                color: Colors.green,<br>              ),<br>              title: const Text(<br>                &quot;Success&quot;,<br>                style: TextStyle(<br>                  fontSize: 18,<br>                  fontWeight: FontWeight.w700,<br>                  color: Colors.green,<br>                ),<br>              ),<br>              backgroundColor: Colors.green[50],<br>              iconColor: Colors.green,<br>              shape: const Border.fromBorderSide(BorderSide.none),<br>              tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>              children: [content],<br>            ),<br>            ExpansionTile(<br>              leading: const Icon(<br>                Icons.dangerous_outlined,<br>                size: 24,<br>                color: Colors.red,<br>              ),<br>              title: const Text(<br>                &quot;Alert&quot;,<br>                style: TextStyle(<br>                  fontSize: 18,<br>                  fontWeight: FontWeight.w700,<br>                  color: Colors.red,<br>                ),<br>              ),<br>              backgroundColor: Colors.red[50],<br>              iconColor: Colors.red,<br>              shape: const Border.fromBorderSide(BorderSide.none),<br>              tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>              children: [content],<br>            ),<br>            ExpansionTile(<br>              leading: const Icon(<br>                Icons.dangerous_outlined,<br>                size: 24,<br>                color: Colors.blue,<br>              ),<br>              title: const Text(<br>                &quot;Primary&quot;,<br>                style: TextStyle(<br>                  fontSize: 18,<br>                  fontWeight: FontWeight.w700,<br>                  color: Colors.blue,<br>                ),<br>              ),<br>              backgroundColor: Colors.blue[50],<br>              iconColor: Colors.blue,<br>              shape: const Border.fromBorderSide(BorderSide.none),<br>              tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>              children: [content],<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThaZiPkQjdX0XkRyZyWbpw.png" /></figure><p>จากที่เห็น code ด้านบนยาวพรืดเลยและ มีการใช้งานค่าซ้ำๆ กันเช่น <br> shape: Border.fromBorderSide(BorderSide.none)<br> tilePadding: EdgeInsets.symmetric(horizontal: 24)<br>เราสามารถลดการใช้ซ้ำได้โดยอาจจะประการ ShapeBorder ไว้ด้านบนแล้วเรียกใช้<br>หรือ เก็บ props ใส่ Map แล้ววน loop แต่ผมจะทำการแยก Widget ออกมาแบบนี้</p><pre>// แยก class มาเป็น ExpansionTileCustom อยู่ใน main.dart<br>class ExpansionTileCustom extends StatelessWidget {<br>  final MaterialColor? color;<br>  final Widget? content;<br>  final IconData? icon;<br>  final String titleName;<br><br>  const ExpansionTileCustom({<br>    super.key,<br>    this.color,<br>    this.content,<br>    this.icon,<br>    required this.titleName,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return ExpansionTile(<br>      leading: Icon(icon, size: 24, color: color),<br>      title: Text(<br>        titleName,<br>        style: TextStyle(<br>          fontSize: 18,<br>          fontWeight: FontWeight.w700,<br>          color: color,<br>        ),<br>      ),<br>      backgroundColor: color?[50],<br>      iconColor: color,<br>      shape: const Border.fromBorderSide(BorderSide.none),<br>      tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>      children: [content!],<br>    );<br>  }<br>}</pre><pre>// main.dart<br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    Widget content = Container(<br>      padding: const EdgeInsets.all(10),<br>      child: const Text(&quot;Content Content Content&quot;),<br>    );<br><br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(<br>          leading: const Icon(Icons.abc),<br>          title: const Text(&quot;Play Gorund&quot;, textAlign: TextAlign.center),<br>        ),<br>        body: ListView(<br>          children: [<br>            ExpansionTileCustom(<br>              titleName: &quot;Waring&quot;,<br>              color: Colors.amber,<br>              icon: Icons.warning_amber,<br>              content: content,<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Success&quot;,<br>              color: Colors.green,<br>              icon: Icons.check_circle_outline_outlined,<br>              content: content,<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Alert&quot;,<br>              color: Colors.red,<br>              icon: Icons.dangerous_outlined,<br>              content: content,<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Primary&quot;,<br>              color: Colors.blue,<br>              icon: Icons.category_outlined,<br>              content: content,<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>ทีนี้ Listview ของเราก็จะดูง่ายขึ้น ถ้าเราอยากเพิ่ม props อะไรก็ไปประกาศที่ <br>class ExpansionTileCustom ถ้าใช้หลายตัวก็ต้องเพิ่มหลายตัว เรามีวิธีง่ายกว่านั้นนั่นก็คือการ Override Widget โดยใช้ extends</p><pre>class ExpansionTileCustom extends ExpansionTile {<br>  final MaterialColor? color;<br>  final IconData? icon;<br>  final String titleName;<br><br>  ExpansionTileCustom({<br>    super.key,<br>    super.children,<br>    super.subtitle,<br>    super.textColor,<br>    this.color,<br>    this.icon,<br>    required this.titleName,<br>  }) : super(<br>          leading: Icon(icon, size: 24, color: color),<br>          title: Text(<br>            titleName,<br>            style: TextStyle(<br>              fontSize: 18,<br>              fontWeight: FontWeight.w700,<br>              color: color,<br>            ),<br>          ),<br>          backgroundColor: color?[50],<br>          iconColor: color,<br>          shape: const Border.fromBorderSide(BorderSide.none),<br>          tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>        );<br>}</pre><p>จากที่เห็นเราเรียกใช้ field หรือ method จาก class ExpansionTile โดยใช้ super<br>และไม่ต้องไปประกาศ field ใหม่ เว้นแต่อยากได้ field ที่เจาะจง type หรือ ชื่อ field ซ้ำกับ super class ก็ต้องประกาศชื่อ field ใหม่ ตามที่ Linter rule แนะนำ</p><p><a href="https://dart.dev/tools/linter-rules/overridden_fields">overridden_fields</a></p><p>หวังว่าบทความนี้จะเป็นประโยชน์ได้บ้างนะครับ กว่าจะได้มาเขียนบทความนี้ ผมก็เขียน Flutter แบบหน้ามืดตามัวมาสักพักเลย จากที่เขียน React อยู่ประจำ ก็ได้มาจับ project ใหม่ ต้องรีบ Learn รีบ Launch เป็นมือใหม่ที่ยังไม่รู้ลึกเท่าไหร่ <br>(จริงๆ ก็เขียนมาหลายเดือนอยู่ 🤣 ) แนะนำติชมกันมาได้เลยครับ</p><pre>// main.dart full code<br><br>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(const MainApp());<br>}<br><br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    Widget content = Container(<br>      padding: const EdgeInsets.all(10),<br>      child: const Text(&quot;Content Content Content&quot;),<br>    );<br><br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(<br>          leading: const Icon(Icons.abc),<br>          title: const Text(&quot;Play Gorund&quot;, textAlign: TextAlign.center),<br>        ),<br>        body: ListView(<br>          children: [<br>            ExpansionTileCustom(<br>              titleName: &quot;Waring&quot;,<br>              color: Colors.amber,<br>              icon: Icons.warning_amber,<br>              children: [content],<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Success&quot;,<br>              color: Colors.green,<br>              icon: Icons.check_circle_outline_outlined,<br>              children: [content],<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Alert&quot;,<br>              color: Colors.red,<br>              icon: Icons.dangerous_outlined,<br>              children: [content],<br>            ),<br>            ExpansionTileCustom(<br>              titleName: &quot;Promary&quot;,<br>              color: Colors.blue,<br>              icon: Icons.category_outlined,<br>              children: [content],<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}<br><br>class ExpansionTileCustom extends ExpansionTile {<br>  final MaterialColor? color;<br>  final IconData? icon;<br>  final String titleName;<br>  // @override<br>  // final String? title;<br><br>  ExpansionTileCustom({<br>    super.key,<br>    super.children,<br>    super.subtitle,<br>    super.textColor,<br>    this.color,<br>    this.icon,<br>    // required super.title,<br>    required this.titleName,<br>  }) : super(<br>          leading: Icon(icon, size: 24, color: color),<br>          title: Text(<br>            titleName,<br>            style: TextStyle(<br>              fontSize: 18,<br>              fontWeight: FontWeight.w700,<br>              color: color,<br>            ),<br>          ),<br>          backgroundColor: color?[50],<br>          iconColor: color,<br>          shape: const Border.fromBorderSide(BorderSide.none),<br>          tilePadding: const EdgeInsets.symmetric(horizontal: 24),<br>        );<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a9d7e83aa81" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/flutter-%E0%B8%97%E0%B8%B3-custom-widget-%E0%B9%82%E0%B8%94%E0%B8%A2%E0%B8%81%E0%B8%B2%E0%B8%A3-override-8a9d7e83aa81">[Flutter] ทำ Custom Widget โดยการ Override</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[มารู้จัก Jam.dev กันครับ]]></title>
            <link>https://medium.com/mintelligence/%E0%B8%A1%E0%B8%B2%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%88%E0%B8%B1%E0%B8%81-jam-dev-%E0%B8%81%E0%B8%B1%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B8%9A-f0a5a6522989?source=rss----c96402b71706---4</link>
            <guid isPermaLink="false">https://medium.com/p/f0a5a6522989</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[m-intelligence]]></category>
            <category><![CDATA[testers]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[Paiboon Toomthongkam]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 06:37:01 GMT</pubDate>
            <atom:updated>2023-05-18T07:38:03.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*NTK4jfmGwgs77s9SoH5Xqw.png" /></figure><p><a href="https://jam.dev/">Jam | Build a bug-free product.</a></p><h3>Jam.dev</h3><p>เป็นเครื่องมือช่วยในการ Log Issue หรือ Log activity โดยสามารถ Capture Screenshot , Record tab , Record desktop ได้โดยรวดเร็วและใช้งานได้ง่าย และ Connect ไปยัง app อื่นได้อีกด้วย เช่น Jira , Slack , Asana , Linear , Github , ClickUp ในการสร้าง Issue ต่างๆ ได้</p><p>ซึ่งเราจะมาแนะนำการใช้ Jam.dev connect jira</p><p>ติดตั้ง Jam.dev</p><p>ติดตั้งผ่าน Chrome ได้เลย <a href="https://chrome.google.com/webstore/detail/jam/iohjgamcilhbgmhbnllfolmkmmekfmci/related">https://chrome.google.com/webstore/detail/jam/iohjgamcilhbgmhbnllfolmkmmekfmci/related</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*cTb5uo7nvyh4Zuwd1hr0jw.png" /><figcaption>Click เพิ่มใน Chrome</figcaption></figure><p>เท่านี้เราก็จะสามารถใช้งานได้แล้ว ง่ายมากๆ</p><p>ลองใช้งานกันเลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKadykxZzUp9DQMXeIdd-A.png" /><figcaption>Click icon ได้เลย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*Dzt2EGREwl9xNMrwg-5Q-Q.png" /><figcaption>เลือกการใช้งานได้เลย ลองที่อันแรกก่อนครับ Capture Screenshot</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebwOAC1F9pcF8uIP6aTKHQ.png" /><figcaption>มี popup ขึ้นมาแล้ว เราสามารถเพิ่มหรือ note ต่างๆได้เลย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuzpvqQFZpUWIfvIlxux-A.png" /><figcaption>และกด Create ได้เลย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QR9ZxZfKXjf9c3qWHPZggQ.png" /><figcaption>หรือ สร้าง Issue บน app อื่นๆได้ เช่น Jira</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*orMNWojAhDgyiTr3rnCZ2g.png" /><figcaption>สามารถเลือก Project ได้ด้วย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtRUnnCgVbSDNEMelrhidw.png" /><figcaption>ไม่พอเท่านั้นเราสามาเลือก Fields ที่อยู่ใน Type นั้นๆมาได้ด้วย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHWwxjfV9EOK6ZNyd4jTTQ.png" /><figcaption>Save issue ได้เลย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*7aqr8zqoH3RFP2C93FWnrQ.png" /><figcaption>รอโหลดสักครู่</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*n0CpkF3r-qccMoF-kgPp-A.png" /><figcaption>เสร็จเรียบร้อย สามารถ copy link ได้ด้วย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*aEeAlMEivJ18jNu-Zd29uw.png" /><figcaption>เรามาดูกันว่า jam.dev สร้างอะไรมาให้บ้างนอกเหนือจากที่เราได้กรอกไปก่อนหน้านี้</figcaption></figure><p><strong>Website URL เราได้ url มาด้วยอันนี้ชอบมากเลยครับ เราไม่ต้องมา copy แล้วเอามาใส่เอง</strong></p><p><strong>Device and browser info บอกด้วยว่า Issue Device and browser นี้ผ่านอะไร</strong></p><p><strong>View developer information (console logs, network requests &amp; timing) อันนี้บอกเลยว่าดีมากครับ</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bd2zm1mqOF9tqj6lSQ3tLg.png" /><figcaption>ดู network ได้</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n7EBoBOP1mDZU3_S0k6S7A.png" /><figcaption>ดู Console ได้</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JImJggQv0vgmaKWdRjsx2A.png" /><figcaption>มี info ให้ด้วย</figcaption></figure><p><strong>View developer information อันนี้จะช่วยลดเวลาให้กับ developer เป็นอย่างมากครับ ช่วยในการสื่อได้อย่างดีเยียมเหมือนได้รู้ปัญหาเบื้องต้นได้ทันทีโดยที่ยังไม่ต้องมาคุยกับคนสร้าง Issue เลย</strong></p><p>สรุปสั่นๆ Jam.dev จะมาช่วยในการ Report Issue และ Connect กับ Tool ต่างๆได้อีกด้วยจะลดเวลาการทำงาน</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a5a6522989" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mintelligence/%E0%B8%A1%E0%B8%B2%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%88%E0%B8%B1%E0%B8%81-jam-dev-%E0%B8%81%E0%B8%B1%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B8%9A-f0a5a6522989">มารู้จัก Jam.dev กันครับ</a> was originally published in <a href="https://medium.com/mintelligence">Mintelligence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>