Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,820 --> 00:00:05,800
In the last section, we started working on our image list widget before we add any methods to this
2
00:00:05,800 --> 00:00:09,330
thing, I want to make sure that it gets displayed by the app widget.
3
00:00:09,820 --> 00:00:13,870
So I'm going to flip over to my app dart file at the very top.
4
00:00:13,870 --> 00:00:17,140
I'm going to import the image list widget that we just created.
5
00:00:18,260 --> 00:00:24,320
So I will import from the widgets folder, the image list, darte file.
6
00:00:27,700 --> 00:00:34,180
Now, to make sure that our app widget shows the image list, I'm going to find the app states builder
7
00:00:34,180 --> 00:00:34,630
method.
8
00:00:36,200 --> 00:00:42,140
Here's builded right here and somewhere inside of here, we need to create a new instance of image list
9
00:00:42,470 --> 00:00:47,330
that's going to make sure that any time the app widget shows on the screen, it will also show the image
10
00:00:47,330 --> 00:00:53,600
list, which is at present are scaffold, which it has a body parameter of that text counter.
11
00:00:54,050 --> 00:00:56,440
Now, we don't really need to show that text counter anymore.
12
00:00:56,480 --> 00:01:01,670
So I think that we should probably replace that text widget and instead show an instance of the image
13
00:01:01,670 --> 00:01:02,020
list.
14
00:01:02,810 --> 00:01:08,090
So for the body parameter right here, I will create a instance of image list.
15
00:01:09,430 --> 00:01:15,160
Now, any time that we create our copy of Image List right here and try to show it on the screen, the
16
00:01:15,160 --> 00:01:21,460
image list is definitely going to need that list of all the image models that we have fetched so far.
17
00:01:22,470 --> 00:01:28,830
So we need to take this list of images and pass it down to the image list widget, so to do so, I'm
18
00:01:28,830 --> 00:01:33,950
going to go back to the image list constructor right here, and I will pass images into it.
19
00:01:36,820 --> 00:01:38,110
OK, so that looks good.
20
00:01:38,140 --> 00:01:41,710
We've now communicated our list of images down to the image list.
21
00:01:42,320 --> 00:01:46,900
However, you'll notice we got the red squiggly right here is because we are trying to pass down an
22
00:01:46,900 --> 00:01:53,080
argument to the image list, but we have not yet configured the image list constructor to accept a list
23
00:01:53,080 --> 00:01:53,680
of images.
24
00:01:54,430 --> 00:02:00,370
So to make sure that the image list expects to get this list, I will open up my image list dirt file
25
00:02:00,370 --> 00:02:05,620
again, and I'm going to add a constructor method to this thing that's going to accept that list of
26
00:02:05,620 --> 00:02:08,650
images and assign it to an instance variable.
27
00:02:09,789 --> 00:02:12,580
I'll first put together the image list constructor.
28
00:02:14,640 --> 00:02:20,970
And this thing is going to accept a parameter as the first argument, we'll say distort images, and
29
00:02:20,970 --> 00:02:26,730
so because we put down this dot images, that is assuming that we're going to have a instant's variable
30
00:02:26,730 --> 00:02:27,900
called images.
31
00:02:28,740 --> 00:02:35,460
So I will say, just as we have before, we want a list that's going to contain image models.
32
00:02:36,450 --> 00:02:38,970
And we want to call that images like some.
33
00:02:40,500 --> 00:02:45,870
Now, when I do so, I'm going to flip over this thing right here, you know, I've got a little air
34
00:02:45,870 --> 00:02:46,860
on image list.
35
00:02:47,520 --> 00:02:52,110
One of the areas that we have at present is something that says that we are missing a implementation
36
00:02:52,110 --> 00:02:53,130
of the build method.
37
00:02:53,580 --> 00:02:55,670
OK, well, you know, that's to be expected.
38
00:02:55,680 --> 00:02:56,400
No problem there.
39
00:02:57,540 --> 00:02:59,240
But then we've got a second error.
40
00:02:59,910 --> 00:03:06,060
This one says that our class inherits from the class that is marked as immutable and therefore should
41
00:03:06,060 --> 00:03:07,200
also be immutable.
42
00:03:07,230 --> 00:03:13,500
Or another way that it puts it is to say that all the fields or all the instance variables on this class
43
00:03:13,500 --> 00:03:14,700
must be final.
44
00:03:15,390 --> 00:03:20,490
So we're seeing that error message right there because of how we defined this instance variable right
45
00:03:20,490 --> 00:03:20,810
here.
46
00:03:21,390 --> 00:03:22,650
So let's take a quick pause.
47
00:03:22,680 --> 00:03:27,180
We're going to come back and talk about why we're seeing this error message and it's going to tie back
48
00:03:27,180 --> 00:03:32,550
into that whole idea of how stateless widgets are supposed to have data that does not change over time.
49
00:03:33,060 --> 00:03:34,950
So quick break and I'll see you in just a minute.
4988
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.