All language subtitles for 18. Adding Text Input Widgets (TextField)

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,400 --> 00:00:08,700 For the moment and not for the entire app but just for a moment, I'm done with the styling and the setup 2 00:00:08,700 --> 00:00:09,780 of the content. 3 00:00:09,780 --> 00:00:11,930 Of course you can always tweak this to your requirements 4 00:00:11,940 --> 00:00:14,800 and again, we will all change things later 5 00:00:14,970 --> 00:00:17,540 but for the moment, I'm happy with these styles, 6 00:00:17,550 --> 00:00:24,450 I now want to focus on the next steps which means that users should be able to add transactions here. 7 00:00:24,450 --> 00:00:30,720 And for that, we need some button that allows users to start the process of adding a new transaction, 8 00:00:30,930 --> 00:00:36,870 open up some extra page or some extra input field where we can add a transaction, that would be 9 00:00:36,870 --> 00:00:39,280 pretty sweet. For that, 10 00:00:39,310 --> 00:00:41,400 let's go back to our code here 11 00:00:42,010 --> 00:00:48,190 and first of all, I want to add an area where users can enter transaction data. 12 00:00:48,190 --> 00:00:54,380 Now we have our chart container and below that, we have the column with all our transactions. 13 00:00:54,460 --> 00:01:01,030 Now as a start, I want to make sure that this chart container and our transactions actually are ordered 14 00:01:01,030 --> 00:01:06,010 from top and bottom which they are but that they start at the beginning, that we don't have that space 15 00:01:06,010 --> 00:01:07,430 around setting. 16 00:01:07,450 --> 00:01:13,390 So let's go to the overall wrapping column here and change the main axis alignment to start, which 17 00:01:13,390 --> 00:01:14,300 is the default, 18 00:01:14,320 --> 00:01:15,850 hence we can comment this out, 19 00:01:15,950 --> 00:01:17,460 I'm using a shortcut here in my IDE, 20 00:01:17,590 --> 00:01:21,090 you can simply add two slashes in front of that if you want to. 21 00:01:21,160 --> 00:01:25,210 So now with that, we have all that content pushed up to the top 22 00:01:25,330 --> 00:01:30,370 and now I want to add a new input area. For the moment, 23 00:01:30,370 --> 00:01:36,640 I'll add that input area below the chart and that input area in the end will require a couple of different 24 00:01:37,030 --> 00:01:43,240 text inputs for the title, for the amount and then also some input for the date. 25 00:01:43,240 --> 00:01:47,060 Now since we need multiple widgets, what does this mean? 26 00:01:47,200 --> 00:01:49,460 We need a column or a row 27 00:01:49,480 --> 00:01:54,580 because otherwise we can't have multiple widgets in the same part. 28 00:01:54,580 --> 00:01:56,690 Now of course we already are in a column, 29 00:01:56,740 --> 00:02:00,180 so here we could just add our text inputs. 30 00:02:00,280 --> 00:02:05,800 However it would be nice to also have some styling around these text inputs, maybe a border, maybe 31 00:02:05,800 --> 00:02:07,440 a background color 32 00:02:07,450 --> 00:02:14,820 and therefore here we could add a card to get some default styling, light rounded corners, also 33 00:02:14,820 --> 00:02:23,230 some background color and then in there as a child, I want to have my text inputs. Now as I said, this will 34 00:02:23,230 --> 00:02:26,120 be multiple text inputs which should be all in that card, 35 00:02:26,170 --> 00:02:30,070 so since we will have multiple widgets in there, now we definitely need a column. 36 00:02:30,280 --> 00:02:31,080 You could use a row 37 00:02:31,090 --> 00:02:36,250 but I think it makes more sense to have the text inputs sit on top of each other. 38 00:02:36,280 --> 00:02:44,710 Now how do we create a text input though? There is a special widget in Flutter, the text field widget. Don't 39 00:02:44,710 --> 00:02:51,330 confuse it with the text widget, the text widget which we're using down there is responsible for outputting 40 00:02:51,340 --> 00:02:59,360 text, the text field widget is responsible for receiving user input. So we can add a text field widget 41 00:02:59,360 --> 00:03:08,360 here and if I add, let's say for the moment, two text field widgets here and I save this, then indeed 42 00:03:08,360 --> 00:03:10,310 we see two lines here. 43 00:03:10,340 --> 00:03:11,480 So that's our card, 44 00:03:11,480 --> 00:03:15,920 the card is always a bit hard to see on the white background but there is this card around it. 45 00:03:16,190 --> 00:03:21,800 We can maybe add some elevation here to increase the drop shadow, it's a bit easier to see 46 00:03:21,800 --> 00:03:26,650 but most importantly we see these two lines, that's the most important part here. 47 00:03:26,720 --> 00:03:28,160 So we have these two lines 48 00:03:28,250 --> 00:03:34,700 and if I tap into a line here, indeed the soft keyboard should come up. If you're testing this on an iOS 49 00:03:34,700 --> 00:03:43,350 simulator, you might have to enable 2D soft keyboard in your toolbar at the top under the hardware item. 50 00:03:43,430 --> 00:03:47,930 So the soft keyboard comes up and indeed, we can enter text here, 51 00:03:47,930 --> 00:03:53,350 thankfully we can also enter it with our physical keyboard which makes it easier to test this whilst 52 00:03:53,350 --> 00:03:54,620 we are developing. 53 00:03:54,620 --> 00:03:55,490 So that's pretty nice, 54 00:03:55,490 --> 00:03:56,600 we can enter this here, 55 00:03:56,600 --> 00:04:03,610 we can also close the soft keyboard here on Android and therefore, we can enter text. 56 00:04:03,730 --> 00:04:09,640 However, at the moment it's not clear which text should go into which text field and of course it would 57 00:04:09,640 --> 00:04:15,130 also be nice to have some spacing around the text fields so that they don't stretch the entire width 58 00:04:15,130 --> 00:04:16,490 of our card here, 59 00:04:16,620 --> 00:04:24,190 also spacing top and bottom and in general, improve the layout, the styling and also the information 60 00:04:24,280 --> 00:04:34,820 about our text fields. So to style this, as I said it would be nice to have some spacing around our text 61 00:04:34,820 --> 00:04:35,480 fields. 62 00:04:35,480 --> 00:04:43,250 Now on a card itself, you can only define some margin but no padding, so you can't define inner spacing 63 00:04:43,370 --> 00:04:46,910 between the card edges and the content of the card. 64 00:04:46,910 --> 00:04:53,540 The column also has no padding or margin argument, so we can't add spacing here and you learned what 65 00:04:53,540 --> 00:04:54,670 you can do in this case, 66 00:04:54,770 --> 00:04:56,420 wrap it with a container. 67 00:04:56,420 --> 00:05:02,360 So here, we can again use the refactoring tool to wrap the column here with a container and with that 68 00:05:02,360 --> 00:05:05,780 wrapped here, you can add either a margin or a padding, 69 00:05:05,870 --> 00:05:08,630 here it doesn't matter because we're now inside of the card, 70 00:05:08,780 --> 00:05:14,270 so margin around the container will add some spacing between the card and its content and padding here 71 00:05:14,600 --> 00:05:19,630 will not add spacing between card and content because the content would be the container 72 00:05:19,700 --> 00:05:25,580 but since we don't directly see the container, we would have some spacing between the card edge and then 73 00:05:25,580 --> 00:05:28,880 inside of the container between the container and our text fields. 74 00:05:28,910 --> 00:05:30,010 So both would work 75 00:05:30,440 --> 00:05:39,500 and here I will go for padding and use EdgeInsets.all 10 to add a padding of 10 in all directions. 76 00:05:39,500 --> 00:05:43,500 So now we have some spacing and our text input don't stretch the entire width, 77 00:05:43,520 --> 00:05:48,830 we also have some spacing top to bottom. Now it would also be nice to have some labels on the text fields 78 00:05:49,190 --> 00:05:54,450 and thankfully, you can of course also pass arguments to text field to configure that. 79 00:05:54,800 --> 00:06:00,800 If you hit control space, you'll see there are a lot of things you can set. Feel free to go through these 80 00:06:00,800 --> 00:06:02,160 options on your own, 81 00:06:02,330 --> 00:06:07,010 things like autocorrect and autofocus should be pretty clear, autocorrect enables auto correction 82 00:06:07,010 --> 00:06:12,680 when the user enters text, autofocus makes sure that this gets focused the moment it is focusable. 83 00:06:13,620 --> 00:06:20,310 You have more strange arguments like controller and so on which we'll use later. You can change the cursor 84 00:06:20,310 --> 00:06:25,890 color, so that marker in the text field once the user tapped in there, which color it has, which radius, 85 00:06:26,100 --> 00:06:30,460 which width it has. You can change the decoration which will become important for us 86 00:06:30,470 --> 00:06:32,980 in a second, you can enable or disable it, 87 00:06:33,000 --> 00:06:40,830 so whether the user can tap in there and that keyboard comes up or not and so on. As always, play around with 88 00:06:40,830 --> 00:06:45,450 these settings, dive into the official docs and get a feeling for what's happening there. 89 00:06:46,010 --> 00:06:52,910 At the moment for us, the most interesting part here is the decoration argument where we can add an input 90 00:06:52,940 --> 00:06:58,620 decoration object by instantiating the input decoration class which is provided by Flutter 91 00:06:58,790 --> 00:07:04,420 and there you can for example control whether there is a border around our text field, 92 00:07:04,520 --> 00:07:07,950 by default we have this bottom border here. 93 00:07:08,130 --> 00:07:14,760 You can add a counter that indicates how many characters were entered, you can handle different error 94 00:07:14,770 --> 00:07:20,550 styles and these are also things I will come back to later in this course once we dive deeper into handling the 95 00:07:20,550 --> 00:07:23,940 user input, adding validation and so on. For now, we'll not. 10449

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