Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,650 --> 00:00:06,410
In the last section, we got started working on our new login form application, so this iteration of
2
00:00:06,410 --> 00:00:12,290
this application is going to use those classic stateful widgets to somehow manage the form state and
3
00:00:12,290 --> 00:00:15,590
make sure that a user enters a reliable email and password.
4
00:00:16,400 --> 00:00:19,850
We just created the main file and the dart file.
5
00:00:20,360 --> 00:00:24,590
We're going to very quickly start to create a couple of other widgets inside of our application.
6
00:00:24,590 --> 00:00:27,710
And I want to give you a quick preview of exactly what we're going to be doing.
7
00:00:28,430 --> 00:00:32,470
So I put together a diagram that shows all the different widgets that we're going to have to work with.
8
00:00:32,990 --> 00:00:37,790
Now, you'll notice that in this hierarchy at tree, right here at the very top, we have the app,
9
00:00:37,790 --> 00:00:39,020
which is what we just created.
10
00:00:39,110 --> 00:00:43,700
And we've got one other blue square in here, which is this login screen widget.
11
00:00:44,300 --> 00:00:49,010
So the two blue things that you see inside of here are widgets that you and I are going to create.
12
00:00:49,400 --> 00:00:53,600
Every other widget is going to be a part of the flutter standard library.
13
00:00:54,080 --> 00:00:59,240
So as you can see here, the vast majority of elements that are going to show up on the screen for creating
14
00:00:59,240 --> 00:01:02,920
this form are all created and maintained by flutter.
15
00:01:03,320 --> 00:01:08,960
So you and I don't have to manually create these, like, input elements right here, like totally from
16
00:01:08,960 --> 00:01:11,540
scratch and try to work with user input.
17
00:01:11,840 --> 00:01:17,990
Instead, we get these really handy widgets called text form fields that can be used to receive input
18
00:01:17,990 --> 00:01:22,070
from a user and automatically validate whatever the user provided to us.
19
00:01:22,730 --> 00:01:24,860
So let's very quickly go through this hierarchy.
20
00:01:25,740 --> 00:01:29,260
At the very top, we have the app, we're showing the material app inside there.
21
00:01:29,280 --> 00:01:34,320
OK, whatever, we got the scaffold, whatever, and then the next one is where things start to get
22
00:01:34,320 --> 00:01:34,950
interesting.
23
00:01:35,100 --> 00:01:41,010
So we've got this login screen, which is the login screen is going to be responsible for showing the
24
00:01:41,010 --> 00:01:44,150
entire form on the screen to the user.
25
00:01:44,640 --> 00:01:50,940
It's going to be a stateful widget because there's going to be some data generated by the user when
26
00:01:50,940 --> 00:01:55,680
they enter in their email right here that we're going to want to use in some fashion.
27
00:01:56,260 --> 00:01:59,790
So we're going to make the login screen into a stateful widget.
28
00:02:01,760 --> 00:02:07,280
Inside the login screen will show a container solely for styling purposes because we're going to want
29
00:02:07,280 --> 00:02:10,310
to have some margin around the edge of this form.
30
00:02:11,190 --> 00:02:17,970
Inside there will use a built in flutter, which it called a form element, this form right here works
31
00:02:17,970 --> 00:02:24,720
in conjunction with these two text form fields that you see down here to get some inputs on the screen
32
00:02:25,110 --> 00:02:30,030
and provide some interaction for very common operations that we might want to do around a form like,
33
00:02:30,030 --> 00:02:35,790
say, saving whatever user types into the input or validating whatever a user enters in as well.
34
00:02:36,300 --> 00:02:41,430
So again, this form thing right here and these two text form fields are going to be working together
35
00:02:41,430 --> 00:02:42,390
very closely.
36
00:02:43,310 --> 00:02:49,040
Immediately inside the forum, we're going to show a column, the column is just so we can lay out a
37
00:02:49,040 --> 00:02:51,910
handful of widgets in a column sort of layout.
38
00:02:51,920 --> 00:02:58,490
So from top down to bottom inside the column, we're going to have the two text form fields and a raised
39
00:02:58,490 --> 00:02:58,850
button.
40
00:02:59,540 --> 00:03:03,230
The race button, as you might imagine, is going to represent the submit button down here.
41
00:03:03,800 --> 00:03:08,390
The text form fields, again, they are built in standard flutter widgets.
42
00:03:08,660 --> 00:03:10,460
They're going to show these inputs on the screen.
43
00:03:10,670 --> 00:03:14,900
And the reason I'm making kind of a big deal about them is I want you to notice that we don't have any
44
00:03:14,900 --> 00:03:17,780
separate widget to show the labels on here as well.
45
00:03:18,470 --> 00:03:25,760
So the text form field encapsulates everything you would need for showing a text input to a user, not
46
00:03:25,760 --> 00:03:32,210
only the actual input itself, but also the label for it, and also eventually some validation error
47
00:03:32,210 --> 00:03:35,690
as well, like, say, this red text down here.
48
00:03:37,130 --> 00:03:43,070
So the text form field is going to be really the entire basis of our application when it comes to showing
49
00:03:43,070 --> 00:03:44,210
the inputs on the screen.
50
00:03:44,870 --> 00:03:45,170
All right.
51
00:03:45,170 --> 00:03:49,670
So with all this in mind, let's flip back over to our editor and we're going to get started working
52
00:03:49,670 --> 00:03:51,620
on this login screen widget.
53
00:03:52,830 --> 00:03:57,640
All right, so back inside my code editor inside my SIRC directory.
54
00:03:57,660 --> 00:04:02,380
I'm going to make a new folder to house this screen widget that we're about to create.
55
00:04:02,970 --> 00:04:07,260
So inside of SIRC, I'll make a new folder called Screen's.
56
00:04:08,310 --> 00:04:12,510
The idea behind this folder right here is that it might eventually house all the different widgets that
57
00:04:12,510 --> 00:04:18,750
a user can navigate to inside of an application that form like distinct screens that a user can visit.
58
00:04:19,320 --> 00:04:25,010
So in our case, this login screen right here, it's definitely a distinct screen that a user can visit.
59
00:04:25,020 --> 00:04:27,760
And so I'm going to create that in the screens directory.
60
00:04:28,620 --> 00:04:34,830
So inside of here, I'll make a new file called Log in, underscore screen, dot, dot.
61
00:04:36,910 --> 00:04:40,990
Then inside of here will write out some boilerplate for a stateful widget.
62
00:04:42,120 --> 00:04:46,320
At the top, I will import a package from Flutter.
63
00:04:48,390 --> 00:04:56,720
I want material dirt and then I'll make my login screen, which is going to extend state for widget,
64
00:04:57,450 --> 00:05:01,330
and then remember the process that we have to go through for creating a stateful widget.
65
00:05:01,710 --> 00:05:06,360
We have to define that create state method, and we have to create that separate class that's going
66
00:05:06,360 --> 00:05:09,060
to represent the actual state of this widget.
67
00:05:09,930 --> 00:05:14,670
So I'll first begin by making the create state method.
68
00:05:17,250 --> 00:05:24,690
Inside of here, I will return a new login screen to be not new, we don't need that keyword anymore
69
00:05:25,080 --> 00:05:26,700
login screen status.
70
00:05:27,880 --> 00:05:35,080
And then underneath this all define that class, so say class login screen state, and that's going
71
00:05:35,080 --> 00:05:37,070
to extend state.
72
00:05:37,090 --> 00:05:39,880
And remember, we're going to use that generic type syntax.
73
00:05:40,240 --> 00:05:44,830
So the state right here is going to have a generic that conforms to the login screen type.
74
00:05:44,830 --> 00:05:47,260
So login screen.
75
00:05:49,690 --> 00:05:56,320
And then inside of here will define our build method, which is going to return a widget like so.
76
00:05:58,010 --> 00:06:01,410
OK, so good place to get started with just a little bit of boilerplate here.
77
00:06:01,460 --> 00:06:06,090
Again, this is all the same stateful widget stuff that we put together on the last application.
78
00:06:06,320 --> 00:06:11,690
So if any of this looks confusing, you can always pause the video here and go back to the last application
79
00:06:11,690 --> 00:06:12,950
and look all this stuff up.
80
00:06:13,520 --> 00:06:18,320
I would give you another big lecture about what it's all doing for us, but we definitely spoke about
81
00:06:18,320 --> 00:06:20,040
it in great detail in the last application.
82
00:06:20,060 --> 00:06:23,570
So, again, if it is confusing, I recommend you go back over there.
83
00:06:24,140 --> 00:06:25,780
OK, so let's take a quick pause right here.
84
00:06:25,820 --> 00:06:30,130
We'll come back to the next section and we're going to start fleshing out this build method right here.
85
00:06:30,380 --> 00:06:32,250
So quick break and I'll see you in just a minute.
9163
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.