Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,710 --> 00:00:05,750
In the last section, we finished up a refactor that moved a bunch of logic from our main function inside
2
00:00:05,750 --> 00:00:11,090
of the main dart file into a new custom widget that we defined inside of our app dart file.
3
00:00:11,930 --> 00:00:19,430
Inside the outdoor dirt file, we created a new custom widget by defining a new class that extended
4
00:00:19,460 --> 00:00:21,810
the base class of stateless widget.
5
00:00:22,460 --> 00:00:27,710
We made this a stateless widget because we did not expect it to have to maintain any of its own data.
6
00:00:27,830 --> 00:00:29,180
That would change over time.
7
00:00:29,810 --> 00:00:33,110
That might change at some point, and it might change very shortly.
8
00:00:33,260 --> 00:00:35,680
But at least for right now, it was a good place to get started.
9
00:00:36,960 --> 00:00:44,760
Any time that we define a custom widget, we must define a method on that custom widget called Build
10
00:00:45,570 --> 00:00:47,910
the build method has three requirements.
11
00:00:48,270 --> 00:00:50,070
First off must be called built.
12
00:00:50,200 --> 00:00:51,240
That's obvious enough.
13
00:00:51,660 --> 00:00:53,880
Secondly, it must return a widget.
14
00:00:54,660 --> 00:00:59,760
Third, it must accept a single argument that we referred to as context.
15
00:01:00,150 --> 00:01:04,980
And you'll sometimes hear this referred to as the build context because that's technically the type
16
00:01:05,099 --> 00:01:06,510
of the value that gets passed in.
17
00:01:07,260 --> 00:01:10,860
We will eventually come back and talk a lot more about what this context thing is.
18
00:01:10,860 --> 00:01:13,380
But for right now, we're just going to gloss over it a little bit.
19
00:01:14,560 --> 00:01:20,950
So then inside of our build method, we assembled a new material app widget that had all of its own
20
00:01:20,950 --> 00:01:22,730
custom widgets nested inside of it.
21
00:01:23,440 --> 00:01:25,090
We then return the entire thing.
22
00:01:27,130 --> 00:01:32,380
Then back over inside of our main dirt file, we imported the custom map widget that we just created.
23
00:01:34,060 --> 00:01:39,520
We then created a new instance of that widget and passed the instance off to the run app function.
24
00:01:40,420 --> 00:01:47,800
Then presumably behind the scenes run app took that instance of our app widget, and I assume at some
25
00:01:47,800 --> 00:01:50,440
point time probably called this build method right here.
26
00:01:51,330 --> 00:01:56,790
It got back all these definitions of what our app is supposed to look like and then rendered all those
27
00:01:56,790 --> 00:02:01,680
widgets onto the screen of our mobile device, so that's a review of where we're at right now.
28
00:02:02,070 --> 00:02:05,760
Now, before we move on, there's one last little concept I want to reveal here.
29
00:02:07,630 --> 00:02:12,880
OK, so this is what we refer to as our widget tree, and it's a very handy way of visualizing all the
30
00:02:12,880 --> 00:02:15,290
different images that are being displayed inside of our application.
31
00:02:16,030 --> 00:02:22,690
So at this point, everything inside of our application is being rendered ultimately by the app widget
32
00:02:22,690 --> 00:02:23,710
that we just put together.
33
00:02:24,460 --> 00:02:29,820
The App Widget is returning from its build method, the material app widget.
34
00:02:30,010 --> 00:02:33,580
So as a direct child to the app, we have our material app.
35
00:02:34,600 --> 00:02:39,040
Then as a direct child to the material app, we have the scaffold that we put together.
36
00:02:39,790 --> 00:02:46,210
Then the scaffold itself shows two widgets, the floating action button and the app bar, and each of
37
00:02:46,210 --> 00:02:49,930
those are showing its own respective widgets of icon and text.
38
00:02:50,650 --> 00:02:55,990
So again, this is a handy way to picture our widgets as they are built inside of our application.
39
00:02:56,410 --> 00:03:00,400
And we're going to eventually create a couple of different diagrams like this to better understand the
40
00:03:00,400 --> 00:03:06,160
flow of data inside of our application when we start introducing state or data that changes over time
41
00:03:06,160 --> 00:03:07,350
inside of our app as well.
42
00:03:08,560 --> 00:03:10,000
OK, so that's a good review.
43
00:03:10,150 --> 00:03:11,480
Let's take a quick pause right here.
44
00:03:11,710 --> 00:03:15,670
We're going to come back the next election and we're going to start working on the next piece of functionality
45
00:03:15,670 --> 00:03:16,630
inside of our app.
4714
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.