Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,660 --> 00:00:05,790
In the last section, we got some content to display on the screen of our device, but yeah, it doesn't
2
00:00:05,790 --> 00:00:06,520
look that great.
3
00:00:06,570 --> 00:00:10,980
So in this section, we're going to start looking at a lot of flutter documentation and get a better
4
00:00:10,980 --> 00:00:14,890
idea of how we can build out a nice looking up like the one that we're trying to build.
5
00:00:15,510 --> 00:00:16,379
So let's get to it.
6
00:00:16,870 --> 00:00:20,110
I'm going to first get started by going back over to my main dart file.
7
00:00:20,640 --> 00:00:25,920
Now, just to keep the code inside of here a little bit more legible, I'm going to delete the comments
8
00:00:25,920 --> 00:00:26,570
that I had added.
9
00:00:26,820 --> 00:00:31,560
So if you want to keep your comments around totally fine, I'm just going to remove them so that you
10
00:00:31,560 --> 00:00:34,440
can see the code that I'm writing a little bit more easily.
11
00:00:38,300 --> 00:00:40,240
OK, and there we go.
12
00:00:41,510 --> 00:00:43,790
It's now ready to add some more code to this file.
13
00:00:44,990 --> 00:00:48,490
All right, before we do, I want to take one more quick look at our mock up over here.
14
00:00:48,950 --> 00:00:54,740
So inside of our mock up, we've got this sort of heter thing at the top and then we've got that kind
15
00:00:54,740 --> 00:00:58,850
of floating action button down here and then we at some point time.
16
00:00:58,850 --> 00:01:01,870
So show some content on the bottom of the screen.
17
00:01:02,510 --> 00:01:07,670
So like I had said earlier, when we try to build flutter apps, we spend a lot of time looking at the
18
00:01:07,670 --> 00:01:13,700
flutter documentation, more and more specifically, the documentation around the default widgets that
19
00:01:13,700 --> 00:01:15,950
we get for free when we make use of flutter.
20
00:01:16,640 --> 00:01:21,200
So let's go take another look at the flutter documentation around all those included widgets.
21
00:01:21,350 --> 00:01:25,970
And we'll see if there's not some widget out there that is going to help us achieve this kind of layout
22
00:01:26,270 --> 00:01:29,900
where we have this header at the top and the button down here.
23
00:01:31,120 --> 00:01:33,880
So I'm going to, again, pull up my flutter documentation.
24
00:01:35,320 --> 00:01:42,560
Which I can reach at Flutters Widgets, this is the widgets catalog, which we looked at just a couple
25
00:01:42,560 --> 00:01:46,960
of videos ago, I'm going to open up the material components section again.
26
00:01:47,830 --> 00:01:52,510
And as you might guess, we're going to again look at this scaffold widget.
27
00:01:53,230 --> 00:01:58,330
So on the scaffold widget, I'm going to open up documentation and we'll get a better sense of how to
28
00:01:58,330 --> 00:01:59,310
put this thing together.
29
00:02:00,390 --> 00:02:07,050
So if we want to show a scaffold widget on the screen, we can create a new scaffold and then pass in
30
00:02:07,050 --> 00:02:09,139
some of these different other widgets.
31
00:02:09,990 --> 00:02:13,340
And I'm going to zoom in here for just a moment so we can see is more easily.
32
00:02:13,950 --> 00:02:20,220
I know that this list of widgets right here probably looks very, very overwhelming at first glance.
33
00:02:20,580 --> 00:02:24,840
And I'll tell you, one of the hardest parts of getting used to flutter is just the sheer number of
34
00:02:24,840 --> 00:02:27,850
widgets and different classes that are made available to you.
35
00:02:28,260 --> 00:02:33,030
There's an absolute learning curve here as you're going to have to spend some of your own time looking
36
00:02:33,030 --> 00:02:38,220
at the official documentation and building apps and making use of all these different classes to get
37
00:02:38,220 --> 00:02:40,740
a better idea of what is available to you.
38
00:02:41,490 --> 00:02:46,390
Definitely this flutter catalogue of widgets is helpful, but it only goes so far.
39
00:02:46,440 --> 00:02:49,310
So it's going to take a little bit of practice on our part.
40
00:02:50,160 --> 00:02:54,750
So essentially to build out this sort of layout that we're going after where we've got the header up
41
00:02:54,750 --> 00:03:00,600
top and the button down here, we're going to create an instance of our scaffolded class and then we're
42
00:03:00,600 --> 00:03:06,480
going to create an app bar, which is going to represent that horizontal bar at the very top of our
43
00:03:06,480 --> 00:03:06,900
app.
44
00:03:07,680 --> 00:03:13,230
And then we're also going to create a floating action button, which is a circular button shown on the
45
00:03:13,230 --> 00:03:14,610
bottom right corner of the app.
46
00:03:15,730 --> 00:03:20,560
So we're going to essentially create three widgets in total, we're going to make an instance of the
47
00:03:20,560 --> 00:03:26,620
scaffold, an instance of an APAs, an instance of a floating action button, and then we're going to
48
00:03:26,620 --> 00:03:28,180
wire them all up together.
49
00:03:29,440 --> 00:03:32,980
So let's flip back over to our code editor and get started on this process.
50
00:03:34,720 --> 00:03:40,150
OK, let's back over here at present, our application is showing a text widget now we probably don't
51
00:03:40,150 --> 00:03:43,960
want to show the text widget at all times, so I'm going to remove that to start.
52
00:03:44,720 --> 00:03:50,890
I am going to leave behind our material app because we definitely want all that very basic functionality
53
00:03:50,920 --> 00:03:56,680
that is included in a material app such as what we mentioned before, the ability to navigate between
54
00:03:56,680 --> 00:03:57,500
different screens.
55
00:03:58,090 --> 00:04:02,650
Now, our application in particular doesn't require any navigation, but in general, you're going to
56
00:04:02,650 --> 00:04:07,120
end up using a material app anyways for any app that needs any amount of navigation.
57
00:04:07,120 --> 00:04:08,770
Some is going to leave this in here for now.
58
00:04:10,510 --> 00:04:15,040
Then inside of this named home perimeter, you remember, whatever we pass in here, it's going to be
59
00:04:15,040 --> 00:04:16,829
the first widget that is shown on the screen.
60
00:04:17,140 --> 00:04:20,290
I'm going to create a new scaffold widget.
61
00:04:21,800 --> 00:04:27,320
Now, as we just saw, we're going to have to create and pass a couple of different widgets to the scaffold,
62
00:04:27,530 --> 00:04:31,190
and so I'm going to put a new line inside of here to give myself a little bit of space.
63
00:04:32,590 --> 00:04:34,900
Then we're going to create an app bar.
64
00:04:36,060 --> 00:04:40,950
And if I go to my constructor's section again and find my scaffolded section, we can see that if we
65
00:04:40,950 --> 00:04:47,670
create an app far, we can assign that to the named parameter of app bar on the scaffold itself.
66
00:04:48,300 --> 00:04:56,550
So in short, we want to write out Inside the Scaffold App Bar, and that's going to be an app bar component.
67
00:04:57,360 --> 00:05:02,340
And then I'll put a comma at the end of the line so that I can save this file and the code will not
68
00:05:02,340 --> 00:05:02,870
collapse.
69
00:05:03,450 --> 00:05:08,130
Remember, if I omit these commas, then the code is going to collapse when I save the file, although
70
00:05:08,130 --> 00:05:09,900
that does depend upon your code editor.
71
00:05:11,880 --> 00:05:18,040
OK, so there's our app bar, so let's not save this oops with the comment there one more time.
72
00:05:18,690 --> 00:05:19,590
Now, come on.
73
00:05:20,490 --> 00:05:22,690
There we go, so I'm not going to save this file.
74
00:05:22,740 --> 00:05:26,790
We're going to refresh our emulator one more time and see what we get on the screen now.
75
00:05:27,510 --> 00:05:29,340
So I'm going to first pull up my emulator.
76
00:05:29,980 --> 00:05:33,330
I'm going to pull up my terminal and remember to refresh our app.
77
00:05:33,330 --> 00:05:37,500
We can press shift our on our keyboard, so I'll hit shifta.
78
00:05:38,130 --> 00:05:39,720
That will restart my application.
79
00:05:43,110 --> 00:05:50,010
And that's the result of our scaffolded component to the scaffold component gets this nice white background
80
00:05:50,010 --> 00:05:55,530
on the screen and then the app component or the app, our widget gets this blue bar up here at the very
81
00:05:55,530 --> 00:05:55,880
top.
82
00:05:56,550 --> 00:06:02,120
Now present the blue bar is totally empty and it doesn't appear that there is any text inside of here.
83
00:06:02,430 --> 00:06:03,870
So let's take a quick break.
84
00:06:03,870 --> 00:06:08,010
We'll come back to the next section and we'll figure out how we can add some text to that app var.
8965
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.