Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,800 --> 00:00:05,870
In the last section, we got our little plus button to show up right here with that plus's very small
2
00:00:05,870 --> 00:00:07,210
and definitely pretty hard to see.
3
00:00:07,670 --> 00:00:13,070
So to fix this issue, we're going to find our child named parameter on our floating button right here.
4
00:00:13,250 --> 00:00:18,170
And rather than showing a text widget, we're going to replace it with a widget that shows an actual
5
00:00:18,170 --> 00:00:19,550
plus icon.
6
00:00:20,550 --> 00:00:24,890
Let's take a look at the documentation around icons and get a better idea of how we work with them.
7
00:00:26,040 --> 00:00:33,120
All right, so inside my browser, I'm going to search for the icon class we want specifically icon
8
00:00:33,120 --> 00:00:33,750
singular.
9
00:00:34,960 --> 00:00:40,090
So we'll look at the documentation for this, I'm going to scroll on down to our constructor function.
10
00:00:40,540 --> 00:00:41,430
Here it is right here.
11
00:00:41,890 --> 00:00:46,590
You'll notice that this constructor function has a kind of interesting signature to it.
12
00:00:47,110 --> 00:00:51,970
So on a lot of the other widgets we've looked at so far, they all took named parameters.
13
00:00:52,120 --> 00:00:56,370
And I remember a name parameter is indicated by the presence of those curly braces.
14
00:00:56,770 --> 00:00:59,890
So here's the opening curly brace and here's the closing one right here.
15
00:01:00,690 --> 00:01:08,490
But in this case, the icon class takes a positional argument as well, so the icon class always expects
16
00:01:08,490 --> 00:01:13,770
that you call it with a first argument, the icon that you want to actually show.
17
00:01:14,490 --> 00:01:20,090
And then in addition to that first argument, you can optionally provide some number of named parameters.
18
00:01:20,820 --> 00:01:25,470
Now, that might sound a little bit confusing, but we'll see a better example of this later on with
19
00:01:25,470 --> 00:01:27,900
another widget that we're going to use inside this course.
20
00:01:28,470 --> 00:01:32,690
In this particular case, we don't really care about any of these name parameters.
21
00:01:32,700 --> 00:01:34,850
We only care about the first argument.
22
00:01:34,890 --> 00:01:38,370
So this is not the best place to go into this in more detail.
23
00:01:38,370 --> 00:01:40,320
But again, we'll talk about it a little bit later.
24
00:01:42,210 --> 00:01:48,090
So in order to show an icon or first going to place an icon widget and then as the first argument,
25
00:01:48,240 --> 00:01:54,110
we're going to specify which actual icon we want to show, that might sound confusing.
26
00:01:54,120 --> 00:01:57,750
So let's try writing out the code for it and you'll get a better idea of what's going on.
27
00:01:58,720 --> 00:02:04,120
I'm going to go back over to my code, Ed. I'm going to find that existing text widget and I'm going
28
00:02:04,120 --> 00:02:06,940
to replace it with Ikon instead.
29
00:02:07,860 --> 00:02:14,190
So by just riding out icon that is telling Flutter that we want to show an icon here, but just riding
30
00:02:14,190 --> 00:02:18,420
out icon doesn't actually indicate which icon we want to show.
31
00:02:18,930 --> 00:02:22,310
Flitter has access to a huge collection of different icons.
32
00:02:22,530 --> 00:02:26,910
So we need to be very specific and say, hey, here's the icon that we're trying to show right here.
33
00:02:27,680 --> 00:02:33,940
So as the first argument to specify which icon we want to show, we're going to right out icons noticed
34
00:02:33,940 --> 00:02:37,860
that in this case we have an S right there dot ad.
35
00:02:38,890 --> 00:02:42,310
OK, so I'm not going to say anything about this just yet, let's just save this.
36
00:02:42,340 --> 00:02:44,830
We're going to refresh our simulator and see how we're doing.
37
00:02:46,580 --> 00:02:52,670
So if I do a shifter to do a hot restart, watch little button down here and when the reload kicks in,
38
00:02:53,000 --> 00:02:55,280
you're going to notice that it just got a little bit bigger.
39
00:02:55,580 --> 00:03:00,110
So that's definitely a more appropriate, appropriately sized plus icon for that button.
40
00:03:00,940 --> 00:03:05,050
OK, so let's go back over to our code editor and talk about what this is doing right here.
41
00:03:06,500 --> 00:03:12,650
So, again, we first placed the icon widget, which just tells Flutter, I want to show an icon, but
42
00:03:12,650 --> 00:03:14,450
it doesn't actually specify which one.
43
00:03:15,320 --> 00:03:21,880
To see which icon we want to show we right out icons and then the name of the icon we want to use.
44
00:03:22,370 --> 00:03:30,680
So in this case, to show a plus icon that icons name is ADD, let me show you a list of all the possible
45
00:03:30,680 --> 00:03:31,790
icons we can use.
46
00:03:31,790 --> 00:03:34,660
And I think the syntax right here will make a little bit more sense.
47
00:03:35,890 --> 00:03:43,710
So inside my browser, I'm going to open up a new tab and you can navigate to material slash tool slash
48
00:03:43,720 --> 00:03:44,080
icon.
49
00:03:44,120 --> 00:03:46,270
Let me put that in larger text.
50
00:03:46,300 --> 00:03:46,720
There we go.
51
00:03:48,940 --> 00:03:52,570
So this has a list of all the different icons that we have access to in Flutter.
52
00:03:54,000 --> 00:03:59,790
So here's the icons page, and on this page, you'll see all these different icons and a name for each
53
00:03:59,790 --> 00:04:01,070
one right underneath it.
54
00:04:01,590 --> 00:04:03,480
So we just use the add icon.
55
00:04:04,020 --> 00:04:08,820
If we search for add inside of here and notice, there's a lot of icons with the name add inside of
56
00:04:08,820 --> 00:04:09,060
it.
57
00:04:09,540 --> 00:04:14,090
But if we go long enough, we'll eventually find that plus icon.
58
00:04:14,610 --> 00:04:19,890
So the plus icon is called ADD and that's why he wrote out icons dot at.
59
00:04:20,640 --> 00:04:26,100
If we wanted to instead show some other button like say I don't know, clear right here, this X over
60
00:04:26,100 --> 00:04:28,650
here on the right hand side we could replace.
61
00:04:32,260 --> 00:04:38,440
Back inside of our widget, so instead of seeing icons dot ad, we could instead do what was name clear,
62
00:04:38,740 --> 00:04:41,380
we could do icons dot clear instead.
63
00:04:42,440 --> 00:04:49,310
So if we now do a refresh of our emulator again, the icon showed inside, that button is going to change
64
00:04:49,310 --> 00:04:49,760
on over.
65
00:04:50,970 --> 00:04:53,250
And B, any second now.
66
00:04:57,340 --> 00:04:59,850
OK, come on, it's coming, it's coming.
67
00:05:00,010 --> 00:05:03,610
Well, I'm sure your cells already refreshed and I'm sure you've seen that there is going to be a big
68
00:05:03,610 --> 00:05:04,710
X there instead.
69
00:05:05,260 --> 00:05:07,150
Oh, I won't make you sit around.
70
00:05:07,260 --> 00:05:08,110
OK, there we go.
71
00:05:08,140 --> 00:05:08,950
Well, it didn't actually.
72
00:05:08,970 --> 00:05:09,870
Oh, there we go, finally.
73
00:05:11,080 --> 00:05:12,730
Well, there's definitely a little bit longer than expected.
74
00:05:12,730 --> 00:05:13,840
But yes, you can see it.
75
00:05:13,840 --> 00:05:15,070
There is an X right there.
76
00:05:15,380 --> 00:05:21,220
So in essence, any time that we want to show an icon, we first right out the icon class, which just
77
00:05:21,220 --> 00:05:22,990
says, hey, I want to show an icon.
78
00:05:23,410 --> 00:05:27,670
And then as the first argument to it, we specify which icon we want to show.
79
00:05:27,940 --> 00:05:35,320
And to do so, we write out icons DOT and then the name of the icon and any icon over on this material
80
00:05:35,350 --> 00:05:39,010
dot io tools slash icons page is fair game.
81
00:05:39,010 --> 00:05:42,550
Inside of our application, we can use any of these icons that we wish.
82
00:05:43,390 --> 00:05:44,250
OK, so that's it.
83
00:05:44,710 --> 00:05:48,010
Let's take a quick pause right here and we'll continue in the next section.
8254
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.