All language subtitles for 9. Understanding the Repaint Rainbow

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,170 --> 00:00:04,520 So what's the repaint rainbow here? 2 00:00:04,540 --> 00:00:07,170 I activated it and the result is that 3 00:00:07,230 --> 00:00:13,570 now if I do something in the app like tap a button, I get some borders here and these borders indicate 4 00:00:13,810 --> 00:00:16,110 what was repainted 5 00:00:16,120 --> 00:00:23,770 and the more often something gets repainted, the more often the color around that widget changes 6 00:00:23,770 --> 00:00:29,250 and therefore this is a great tool for finding out whether something changed on the screen 7 00:00:29,260 --> 00:00:31,010 that shouldn't really change. 8 00:00:31,270 --> 00:00:34,980 For example here when I click the buttons, it makes sense that 9 00:00:35,110 --> 00:00:41,740 all this part here changes. However in our application here, since we manage the entire state in the 10 00:00:41,740 --> 00:00:49,080 main.dart file in MyAppState class which is connected to our root, to our topmost widget, the MyApp 11 00:00:49,190 --> 00:00:52,050 widget, since we manage our core state 12 00:00:52,050 --> 00:00:57,560 in here, we always rebuild the entire app and the entire page with every button click. 13 00:00:57,560 --> 00:01:04,610 That's the reason why we also see boundaries or borders, green borders around our appBar for example 14 00:01:04,760 --> 00:01:09,560 because that's also rebuilt when our chosen question changes. 15 00:01:09,590 --> 00:01:15,920 Now that's normal for this application here and it's okay for this simple app but a possible improvement 16 00:01:15,920 --> 00:01:23,690 here could be to wrap our core quizzing logic, with the quiz and the result, into a separate widget which 17 00:01:23,690 --> 00:01:30,560 then manages the state, so that the scaffold and MaterialApp and appBar widget are in a separate widget 18 00:01:30,590 --> 00:01:36,950 where the state is not managed, so that the build method for this widget which contains these never changing 19 00:01:36,950 --> 00:01:39,200 elements is never triggered 20 00:01:39,200 --> 00:01:45,620 and we have the things that do change in a separate widget. That would be one possible optimization which 21 00:01:45,620 --> 00:01:51,680 won't matter here but which we will apply later in the more complex apps we're building to ensure that 22 00:01:51,680 --> 00:01:58,850 we really only trigger the build method on the widgets that did change and not trigger it on unrelated 23 00:01:58,910 --> 00:02:04,070 widgets which don't really need to update because in this app, the appBar never changes, 24 00:02:04,090 --> 00:02:09,570 there is no need to trigger build for it and therefore repaint it on the screen. 25 00:02:09,860 --> 00:02:16,760 One important side note at this point though, repainting on the screen is not the same as recreating 26 00:02:16,760 --> 00:02:17,630 it. 27 00:02:17,630 --> 00:02:23,550 It's of course great if you can avoid it being repainted, for example by outsourcing the parts that do 28 00:02:23,580 --> 00:02:25,760 change into separate widgets 29 00:02:25,760 --> 00:02:33,200 but even if something is repainted, Flutter might be able to simply take the previous element it painted, 30 00:02:33,200 --> 00:02:39,830 so the previous appBar with the exact same color and text and reapply that, then it's still worse than 31 00:02:39,830 --> 00:02:45,830 not repainting it but it's better than recreating it, which would mean that it also had to internally 32 00:02:45,860 --> 00:02:51,530 rebuild the appBar, which takes up a bit more performance than just drawing an element which it already 33 00:02:51,530 --> 00:02:55,590 knows which it already has stored in memory back onto the screen. 34 00:02:55,610 --> 00:03:00,980 It's a small difference but it does matter. An element might be repainted but Flutter might be able to 35 00:03:00,980 --> 00:03:07,160 take an existing element from memory that's better than if Flutter has to create a new element and then 36 00:03:07,160 --> 00:03:14,300 paint that element. Of course, the best is if Flutter neither has to recreate nor repaint an element but 37 00:03:14,300 --> 00:03:20,240 we'll take a closer look at such optimizations later once we're a bit more advanced and we know a bit 38 00:03:20,240 --> 00:03:21,440 more about Flutter. 4488

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.