Flutter 101: RefreshIndicator

Published: 26 February 2019
on channel: Chart
1,274
15

สอนใช้ refresh indicator เพื่อโหลดข้อมูลใหม่เข้าใน list view

00:00:50 มีที่ผิดนิดนึงนะครับสำหรับตัวแปล globalkey ต้องกำหนด type เป็น RefreshIndicatorState ไม่ใช่ ScaffoldState

ใน video พูดว่ามี 2 วิธีแต่ทำวิธีเดียวให้ดู 5555
ขอเพิ่มในนี้แทนนะครับ

วิธีที่ 1 ตามใน video คือ clear data
allCpus.clear()

วิธีที่ 2 คือสร้าง object ใหม่ขขื้นมา โหลดข้อมูลแทนก่อน แล้วค่อยเอาไปใส้ใน allCpus
ประมาณนี้
newAllCpus = loaddata();
allCpus = newAllCpus;

ทั้งสองวิธี ผลที่ได้เมือนกันครับ

sourcecode: https://github.com/chartchuo/pc_build


On this page of the site you can watch the video online Flutter 101: RefreshIndicator with a duration of hours minute second in good quality, which was uploaded by the user Chart 26 February 2019, share the link with friends and acquaintances, this video has already been watched 1,274 times on youtube and it was liked by 15 viewers. Enjoy your viewing!