All language subtitles for 018 Containers for Positioning_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian Download
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,980 --> 00:00:05,570 In the last section, we got our images to show up on the screen, but they're taking up the entire 2 00:00:05,600 --> 00:00:10,610 width of the screen and it's kind of hard to see any multiple number of images at the same time. 3 00:00:11,030 --> 00:00:16,420 If we look back on our mockup over here, we definitely reflected like kind of a border right here. 4 00:00:16,560 --> 00:00:17,470 That's definitely a border. 5 00:00:17,780 --> 00:00:21,540 We showed the image and then the title of the image right underneath it. 6 00:00:22,040 --> 00:00:25,070 Now, there's some fine details in here that I want to point out. 7 00:00:25,680 --> 00:00:31,160 You'll notice that with the border that we're displaying, there's definitely a little bit of spacing 8 00:00:31,160 --> 00:00:34,530 between that border and the actual edge of the devices screen. 9 00:00:35,240 --> 00:00:42,110 In addition, you'll also notice that the image title is not like sitting directly on that border, 10 00:00:42,110 --> 00:00:42,320 right? 11 00:00:42,350 --> 00:00:43,870 It's not like sitting directly on it. 12 00:00:44,090 --> 00:00:48,760 Instead, there's a little bit of spacing between the border and the actual image title. 13 00:00:49,340 --> 00:00:54,800 So I think that we need to learn a little bit more about how to create a border and get some spacing 14 00:00:55,070 --> 00:01:00,570 to the left in the right of the item and some spacing between everything inside of this border as well. 15 00:01:01,190 --> 00:01:04,040 So to get started, I'm going to pull up some documentation again. 16 00:01:05,379 --> 00:01:11,530 So again, at Doc's flutters, oh, I'm going to do a search for a widget called a container. 17 00:01:15,760 --> 00:01:19,570 All right, so a container is exactly what it says right here. 18 00:01:19,600 --> 00:01:22,220 Essentially, it's kind of like a convenience widget. 19 00:01:22,240 --> 00:01:23,130 OK, I can do better than that. 20 00:01:23,140 --> 00:01:24,490 It literally says convenience widget. 21 00:01:24,760 --> 00:01:24,970 All right. 22 00:01:24,970 --> 00:01:26,230 Let me try to get a container. 23 00:01:26,230 --> 00:01:28,980 Class is a very common use widget. 24 00:01:29,260 --> 00:01:35,650 We use it very frequently for positioning elements on the screen or adding any type of styling around 25 00:01:35,650 --> 00:01:36,910 a set of widgets. 26 00:01:37,450 --> 00:01:44,920 In our case, we're going to create a container class that's going to represent this kind of border 27 00:01:44,920 --> 00:01:47,590 around here and inside of that container. 28 00:01:47,590 --> 00:01:51,310 We're going to display our image and our image title as well. 29 00:01:52,480 --> 00:01:57,040 So we need to figure out how to use that container to at least get, you know, the border on there 30 00:01:57,190 --> 00:02:03,400 and also get some margin on the left and right hand sides and a little bit of spacing inside of it as 31 00:02:03,400 --> 00:02:03,660 well. 32 00:02:04,540 --> 00:02:08,860 So back at the container class, as usual, I'm going to take a look at the constructor function. 33 00:02:11,610 --> 00:02:13,350 All right, here's our constructor's right here. 34 00:02:14,260 --> 00:02:23,230 So inside of this container constructor, you'll notice that we have a padding and we also have a margin 35 00:02:23,260 --> 00:02:23,840 right here. 36 00:02:24,370 --> 00:02:30,250 So if you've ever done any amount of Web development or learned anything about CSFs, the words padding 37 00:02:30,250 --> 00:02:32,680 and margin might look a little bit familiar. 38 00:02:33,490 --> 00:02:34,660 Let's take a look at a diagram. 39 00:02:35,230 --> 00:02:35,610 All right. 40 00:02:36,160 --> 00:02:40,660 So in this diagram and I know it's kind of hard to understand what's going on here, but the kind of 41 00:02:40,660 --> 00:02:47,350 blue box on the inside represents some widget that we might want to show inside of our container around 42 00:02:47,350 --> 00:02:48,170 this container. 43 00:02:48,220 --> 00:02:53,830 We get a couple of different spacing elements that we can use to kind of position everything that goes 44 00:02:53,830 --> 00:02:54,730 inside the container. 45 00:02:55,500 --> 00:03:01,320 Immediately outside of the container or outside of the kind of widgets that were going to render inside 46 00:03:01,320 --> 00:03:04,660 of it, we get an area that we refer to as padding. 47 00:03:05,850 --> 00:03:10,260 Padding represents some space that we can assign around our widget. 48 00:03:11,550 --> 00:03:16,800 Right outside of the padding is another layer that we refer to as the border, and that's kind of like 49 00:03:16,980 --> 00:03:18,890 the dark red line right here. 50 00:03:19,770 --> 00:03:23,530 So the border goes all the way around and it's right outside the padding. 51 00:03:24,360 --> 00:03:27,500 And then finally outside of the border is our margin. 52 00:03:28,290 --> 00:03:31,260 So this follows the conventions of CSFs. 53 00:03:31,260 --> 00:03:31,860 Exactly. 54 00:03:32,190 --> 00:03:35,130 We've got our internal elements right outside that. 55 00:03:35,130 --> 00:03:40,890 We've got some space allotted for our padding outside, that we have our border and then outside that 56 00:03:40,890 --> 00:03:42,180 we've got our margin. 57 00:03:42,810 --> 00:03:45,660 So it's kind of relate this back to what you and I are trying to achieve. 58 00:03:46,290 --> 00:03:51,870 This space right here between the border and the screen of the device or the edge of the screen is going 59 00:03:51,870 --> 00:03:53,550 to be our margin spacing. 60 00:03:54,870 --> 00:03:57,570 Then the border itself is going to be, of course, the border. 61 00:03:58,230 --> 00:04:03,960 And then inside the border, the space between our border and any element inside of our container is 62 00:04:03,960 --> 00:04:06,060 going to represent the padding space. 63 00:04:07,110 --> 00:04:11,220 All right, so I know these terms might seem a little bit strange, so let's flip back over to our editor 64 00:04:11,220 --> 00:04:12,900 and start writing out a little bit of code. 65 00:04:13,540 --> 00:04:15,510 So I'm going to find my item builder right here. 66 00:04:16,290 --> 00:04:18,620 Right now, we're just showing Image Dot Network. 67 00:04:19,470 --> 00:04:24,240 I'm going to you know, let's just take that out for a moment and we'll just focus on the container 68 00:04:24,240 --> 00:04:24,690 for right now. 69 00:04:24,690 --> 00:04:27,030 We're going to rewrite rewrite that line of code in just a moment. 70 00:04:27,980 --> 00:04:33,470 So rather than returning the image directly, I'm going to instead return a container and we're going 71 00:04:33,470 --> 00:04:39,170 to apply a bunch of styling and positioning to the container, I'm going to first try to add on some 72 00:04:39,260 --> 00:04:39,920 margin. 73 00:04:41,510 --> 00:04:45,890 Now, if you're again used to web development, you're probably used to defining margin as like, you 74 00:04:45,890 --> 00:04:51,260 know, 20 pixels, 20 pixels or something like that, unfortunately, not quite so easy with flutter 75 00:04:51,710 --> 00:04:59,320 instead to define any spacing like with marchin right here we have to use a class called Edge INSETs. 76 00:05:00,290 --> 00:05:06,710 So this is a class right here that defines some spacing around an element, the term edge insets you 77 00:05:06,710 --> 00:05:11,000 can kind of think of as meaning like spacing around the edge of this element. 78 00:05:12,340 --> 00:05:16,870 The edge in INSETs class has a named constructor on it called all. 79 00:05:18,750 --> 00:05:26,760 The all named constructor right here is referring to all sides of this container, so like the top, 80 00:05:26,880 --> 00:05:29,770 the left, the right and the bottom as well. 81 00:05:30,420 --> 00:05:36,540 So we are trying to define some margin that is going to be applied to all sides of this container element. 82 00:05:37,810 --> 00:05:43,150 Then, as the only argument to this thing we have to pass in a double, remember, that's a number with 83 00:05:43,150 --> 00:05:49,650 a decimal tied to it that represents the pixels of spacing that we want to have around the container. 84 00:05:50,290 --> 00:05:55,450 So for us, I think something around like 20 pixels might work out and remember to define a double. 85 00:05:55,480 --> 00:05:57,460 You have to put the point zero on here. 86 00:05:57,670 --> 00:06:02,070 If you only do 20, you're going to get an error message because that's trying to create an integer. 87 00:06:03,010 --> 00:06:04,480 So we're going to do twenty point eight. 88 00:06:05,770 --> 00:06:11,770 OK, so just to test this out, let's try to get our image to show up inside the container now and we'll 89 00:06:11,770 --> 00:06:14,200 verify that we got some margin around the image. 90 00:06:14,770 --> 00:06:20,310 So to show an element inside of a container, we use the named property of child. 91 00:06:20,710 --> 00:06:27,190 Remember, this child named property is very common, a ton of built in flutter widgets except a child 92 00:06:27,190 --> 00:06:28,840 parameter right here, like the one you see. 93 00:06:29,350 --> 00:06:34,190 And it's a widget that you want to have displayed inside of whatever you're trying to create. 94 00:06:34,750 --> 00:06:39,070 So inside of our container, we want to show that network image that we had just created. 95 00:06:39,550 --> 00:06:45,790 So I'm going to put Image Dot Network and we're going to look at images at index and I want to get the 96 00:06:45,790 --> 00:06:46,960 Eurail off there. 97 00:06:47,630 --> 00:06:52,240 Now, don't forget, at the end of this line, we want to put our comma there to make sure that when 98 00:06:52,240 --> 00:06:54,520 we say the file, the entire thing doesn't collapse. 99 00:06:55,210 --> 00:06:56,440 OK, so quick test. 100 00:06:58,160 --> 00:07:03,950 I'm going to reload my app, so now every time we built a individual item for our list, we're going 101 00:07:03,950 --> 00:07:07,580 to make a container that has some amount of margin assigned to it. 102 00:07:07,790 --> 00:07:10,430 And inside the container is going to be our network image. 103 00:07:11,930 --> 00:07:13,820 So I'll wait for my refresh. 104 00:07:18,100 --> 00:07:19,990 All right, there we go and I'll click the button. 105 00:07:21,340 --> 00:07:28,270 And now I still get the image, but you'll notice I've got what is supposedly about 20 pixels of space 106 00:07:28,420 --> 00:07:29,950 on all sides of the image. 107 00:07:30,070 --> 00:07:31,950 So top left, right. 108 00:07:31,960 --> 00:07:35,470 And if I had another image, I'll see 20 on the bottom as well. 109 00:07:36,220 --> 00:07:40,870 Now, there is even though it looks like there's a little bit more right here, there is still 20 pixels 110 00:07:40,870 --> 00:07:41,450 of margin. 111 00:07:42,220 --> 00:07:47,080 The reason this looks like there so much is that there's 20 pixels of margin on this image on the bottom 112 00:07:47,350 --> 00:07:52,070 and there's 20 pixels of margin on the top of the purple one as well. 113 00:07:52,090 --> 00:07:54,310 So this ends up being 40 pixels right here. 114 00:07:55,270 --> 00:07:58,440 But this definitely looks a little bit better, so let's take a pause right here. 115 00:07:58,480 --> 00:08:04,810 We'll come back to the next section and we will try adding on some padding and a border to that thing 116 00:08:04,810 --> 00:08:05,220 as well. 117 00:08:05,380 --> 00:08:06,750 So I'll see you in just a minute. 11741

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.