Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,930 --> 00:00:05,270
At the end of the last section, we started up our sample application inside of our emulator.
2
00:00:05,720 --> 00:00:10,410
So now you should see the default counter application that tells you how many times you've pressed some
3
00:00:10,410 --> 00:00:13,560
given button and you can click on the button and see that count increment.
4
00:00:14,570 --> 00:00:19,180
Now, I've taken the liberty of also starting up my code editor inside that PIC's directory as well.
5
00:00:19,460 --> 00:00:23,330
And so I encourage you to pause video right now and make sure you start up your code editor to.
6
00:00:24,700 --> 00:00:28,810
Once you get your code editor open, you're going to find a collection of different files and folders
7
00:00:28,810 --> 00:00:30,250
inside of our Picks directory.
8
00:00:31,060 --> 00:00:34,540
We're going to start to explore some of these different files and folders over time.
9
00:00:34,540 --> 00:00:40,360
But right now, we're going to be 100 percent focused on exactly one very specific folder, and that
10
00:00:40,360 --> 00:00:41,880
is the Lib directory.
11
00:00:42,520 --> 00:00:48,010
So 99 percent of all the code that you and I write to build flutter applications is going to be placed
12
00:00:48,010 --> 00:00:49,570
inside of this lib directory.
13
00:00:50,380 --> 00:00:55,240
Every lib directory that you're going to work with is always going to have a main dirt file inside of
14
00:00:55,240 --> 00:00:55,460
it.
15
00:00:56,020 --> 00:00:58,000
The main thought dirt file is very special.
16
00:00:58,300 --> 00:01:03,790
It's the first file that gets loaded up and executed when our application is ran inside of our mobile
17
00:01:03,790 --> 00:01:04,349
device.
18
00:01:04,840 --> 00:01:10,170
So we need to make sure that we always have one file called Main Dart inside the Lib directory.
19
00:01:10,720 --> 00:01:15,310
Now, we can certainly have other files inside of here as well, but at a minimum, we have to have
20
00:01:15,310 --> 00:01:16,630
a main file.
21
00:01:17,630 --> 00:01:22,040
If you now open up this file, you'll see that there's a tremendous amount of code already inside of
22
00:01:22,040 --> 00:01:22,220
here.
23
00:01:22,670 --> 00:01:25,970
Now, I don't know about you, but I like to learn things from scratch.
24
00:01:25,970 --> 00:01:28,490
And I don't really like using a lot of pre generated code.
25
00:01:29,150 --> 00:01:34,160
So rather than trying to work with all this stuff, I'm going to highlight all that code and delete
26
00:01:34,160 --> 00:01:35,150
it like so.
27
00:01:36,420 --> 00:01:40,980
So we'll start completely fresh and we'll get a really good idea of how to build up an application from
28
00:01:40,980 --> 00:01:41,520
scratch.
29
00:01:42,500 --> 00:01:47,240
Now, I'm sure you're very excited to get started on this application right here, but there's going
30
00:01:47,240 --> 00:01:50,210
to be a little bit of a learning curve to get to this point.
31
00:01:50,630 --> 00:01:55,520
So rather than trying to just be line fetching some images and showing them on the screen, I think
32
00:01:55,520 --> 00:01:59,050
we should set a little bit more realistic short term goal.
33
00:01:59,540 --> 00:02:05,000
Let's say that for right now, we'll just try to get some very plain content to appear on the screen
34
00:02:05,000 --> 00:02:05,870
of our device.
35
00:02:06,170 --> 00:02:11,030
So on the screen of our emulator over here, in other words, let's just try to get some very plain
36
00:02:11,030 --> 00:02:12,230
text to show up.
37
00:02:14,030 --> 00:02:19,460
So in order to get some text to show up, I'm going to go back over to my main dirt file and then inside
38
00:02:19,460 --> 00:02:23,930
of here I'm going to lay out a couple of comments that are going to guide me through the process of
39
00:02:23,930 --> 00:02:25,790
getting some content to appear on the screen.
40
00:02:26,520 --> 00:02:31,040
So I'm going to lay out four separate comments that are going to walk us through exactly what we have
41
00:02:31,040 --> 00:02:31,460
to do.
42
00:02:32,820 --> 00:02:40,890
At the very top, I'm going to add a comment that says that I need to import a helper library from Flutter.
43
00:02:41,950 --> 00:02:47,650
To get content on these screen, so can you step one, we're going to have to import some code into
44
00:02:47,650 --> 00:02:52,980
our project and we'll talk exactly about what an import statement is doing for us in just a moment.
45
00:02:53,810 --> 00:02:58,070
But first, let's continue on with a couple more comments, so I think it's second thing we need to
46
00:02:58,070 --> 00:03:04,220
do is define a main function to run when our app starts.
47
00:03:04,980 --> 00:03:10,340
So just as before, back inside of Dark Pad, where we said we have to define a main function, which
48
00:03:10,340 --> 00:03:12,740
is the first function that gets ran inside of our program.
49
00:03:12,980 --> 00:03:15,080
Same is true as a flutter as well.
50
00:03:15,350 --> 00:03:20,810
So every flutter after we build is always going to have exactly one main function defined inside of
51
00:03:20,810 --> 00:03:24,170
it, and that main function will be executed for us automatically.
52
00:03:25,730 --> 00:03:29,210
Then inside that main function, we're going to do two additional steps.
53
00:03:29,870 --> 00:03:38,300
First, we're going to create a new text widget to show some text on the screen.
54
00:03:41,000 --> 00:03:48,860
And then finally, we're going to take that widget and get it on the screen, so creating the text widget
55
00:03:48,860 --> 00:03:53,870
or creating something that's going to show some information on the screen is a slightly different process
56
00:03:53,870 --> 00:03:58,460
than actually taking that thing and telling our mobile device to put it on the screen.
57
00:03:58,880 --> 00:03:59,810
Two separate things.
58
00:03:59,840 --> 00:04:03,980
On the one hand, we have to first create the widget and then the second step is to actually get it
59
00:04:03,980 --> 00:04:05,180
on the screen of our device.
60
00:04:06,020 --> 00:04:08,360
OK, so that's the four steps that we're going to go through.
61
00:04:08,390 --> 00:04:09,620
So let's take a pause right here.
62
00:04:09,800 --> 00:04:13,370
We'll come back to the next section and we're going to start on these four steps.
6464
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.