Flutter Form Validation Tutorial using TextFormField: Flutter tutorial with Dart #3.8

  Рет қаралды 54,196

Smartherd

Smartherd

Күн бұрын

Пікірлер: 93
@gadgetologist
@gadgetologist 6 жыл бұрын
I appreciate your fine work on this and the Dart series. Thank you so much for taking the time to make them. Excellent work!
@smartherd
@smartherd 6 жыл бұрын
Thanks alot.
@garethbeall3674
@garethbeall3674 5 жыл бұрын
Thank you so much for taking the time to provide your expertise - I am really enjoying this series. It's a great introduction into the Flutter world!
@karthigadevi7227
@karthigadevi7227 4 жыл бұрын
Thank you sir......Completely new to app development.. ... Finally created simpleinterest calculator app.. More and more blessings to your humble work.. Pls keep going.. Thanks alot...
@chaitanyadeshpande7241
@chaitanyadeshpande7241 4 жыл бұрын
Just have to add else if (value != TextInputType.number) return 'Invalid Input'; this condition after if condition, and you are ready to go. Thank you Smartherd for these really helpful tutorials.
@oktavianirolly1684
@oktavianirolly1684 9 ай бұрын
not correct,by use this double.tryParse(value)
@rajansingla5516
@rajansingla5516 4 жыл бұрын
I have learnt a lot from your videos weather it's for android, java or now in flutter. Your teaching level is just incredible. Really enjoyed your all fruitful tutorials. God bless you. And can you please make a video like this but use phone text form field with using country codes. It would really be appreciable. Thanks a lot !! 😊
@TheChartwhisperers
@TheChartwhisperers 3 жыл бұрын
How to add separators in the textfield for better user experience??
@karthikgokul1574
@karthikgokul1574 6 жыл бұрын
Hello Sir, awaiting for a next session with database
@akashbhujbal6284
@akashbhujbal6284 6 жыл бұрын
Waiting for our new season Kabhi kabhi lagta hai sir aap hi bhagwan hai....😂😘 Verry nice videos..... thank u🙏
@smartherd
@smartherd 6 жыл бұрын
Soon
@sharmavikas212
@sharmavikas212 6 жыл бұрын
sir i could not find how to validate for number only while entering rate of interest ............ i see that we kept the keyboard to insert number only but i quickly found out that we can copy and paste text to the rate of interest field .......... and also we can insert negative number (i am working on android emulator ).
@domainadministrator2768
@domainadministrator2768 6 жыл бұрын
Hi Vikas, I have done it like this. child: TextFormField( controller: principalData, validator: (String value){ if (value.isEmpty || double.tryParse(value)==null) { return "Please enter a valid amount!"; } }, style: textStyle, keyboardType: TextInputType.number, decoration: InputDecoration( labelText: "Principal Amount", labelStyle: textStyle, hintText: "Enter Principal Amount", border: OutlineInputBorder( borderRadius: BorderRadius.circular(5.0), )), )),
@domainadministrator2768
@domainadministrator2768 6 жыл бұрын
@@peepee_panda779 api.dartlang.org/stable/2.1.0/dart-core/num/tryParse.html . Here is the documentation of tryParse.
@hanielbaez5723
@hanielbaez5723 5 жыл бұрын
@@peepee_panda779 Parse [source] as an double literal and return its value. Like [parse] expept that this function returns NULL fot invalid inputs instead of throwing. From: Dart.core
@rehandev7833
@rehandev7833 5 жыл бұрын
I know its old enough but surely whoever visits here can get an answer to the assignment. I also tried pasting negative numbers and words in the text fields and it successfully eliminates those value. So its completely safe to use this code. child: TextFormField( keyboardType: TextInputType.number, style: textStyle, // Theme Font controller: principalController, //Principal Controller validator: (String value){ if(value.isEmpty){ return 'Please enter principal amount'; } }, inputFormatters: [ WhitelistingTextInputFormatter.digitsOnly //These only allows the TextInputField to have integer values ], decoration: InputDecoration( labelText: 'Principal', labelStyle: textStyle, // Theme Font errorStyle: TextStyle( color: Colors.yellowAccent, fontSize: 15.0 ), hintText: 'Enter Principal e.g. 12000', border: OutlineInputBorder( borderRadius: BorderRadius.circular( 5.0))), )
@dhanshrigunjwate2617
@dhanshrigunjwate2617 4 жыл бұрын
Thank you so much sir , First time I created flutter application. Your video very nice 👌.
@vivekchavda4144
@vivekchavda4144 4 жыл бұрын
Hey @smartherd thanks for providing this course. I learned many new things in this course thank you so much.
@MsSplashIt
@MsSplashIt 6 жыл бұрын
I hope you will do a whole course on firebase/firestore (authentication, role based authorization, crud, storing images and retrieving etc.) really enjoying your courses on flutter and dart. thanks for taking the time to make them
@smartherd
@smartherd 6 жыл бұрын
Sure firebase in queue
@lordeloalvaro
@lordeloalvaro 6 жыл бұрын
When is it going to deploy the next video ? I'm waiting for database ... Do you have any schedule to videos?
@smartherd
@smartherd 6 жыл бұрын
Actually I am in my hometown. Cannot record video till 25th October. You need to wait
@anomihekenneth9586
@anomihekenneth9586 4 жыл бұрын
i keep getting this error The method 'validate' isn't defined for the class 'State'. that the validate() is not defined, how can i correct it
@sephaniakipkoech
@sephaniakipkoech Жыл бұрын
Thank you for the clarity.
@gopi527
@gopi527 5 жыл бұрын
i like your videos a lot .. so simple and so precise , hopefully i get access to your plural sight videos for free ;) , please do more videos on youtube on flutter
@sathwikpalakurty7496
@sathwikpalakurty7496 4 жыл бұрын
i have small doubt where did we use event handlers?? can u please tell
@haquebe1701
@haquebe1701 4 жыл бұрын
And validation on the select drop down?
@floridosmarpepa8904
@floridosmarpepa8904 6 жыл бұрын
Relaly cool till now. But I changed the colors to yellow but then if i want to change the color of the border to the same color?
@ericjonas6044
@ericjonas6044 6 жыл бұрын
Can't wait for the next episodes? To be honest, it's the 1st series which I complete all of them till now. Really good. Just a lil feedback, maybe you can minimize the word "perfect".. repeated quite a few times though :P
@smartherd
@smartherd 6 жыл бұрын
Thanks buddy
@ahmedsiddiqui7528
@ahmedsiddiqui7528 4 жыл бұрын
Hello sir Can you plz tell me the validation of string when if mistakenly Someone enter number instead of alphabets so it should validate
@devyankshaw9365
@devyankshaw9365 4 жыл бұрын
Put the below code in your validator and change rate of interest according to your need: if(checkIsNumber(value)){ return 'Please enter valid rate of interest'; } Put the below code in _SIFormState class: bool checkIsNumber(String value) { try{ num.parse(value); } on FormatException{ return true; } return false; }
@abenezerleta6184
@abenezerleta6184 4 жыл бұрын
thank you bro, you make me to enjoy flutter
@MdYousuf-gw2dn
@MdYousuf-gw2dn 4 жыл бұрын
how can i check that input is a number or not i mean i want to know about the assignment..please help someone {(
@chetanac85
@chetanac85 5 жыл бұрын
hello sir,Got an error. info: This function has a return type of 'String', but doesn't end with a return statement. (missing_return at [smarheard_app] lib\main.dart:90) How I fix this error
@ArpitA5724
@ArpitA5724 4 жыл бұрын
Yes same
@hp666ph
@hp666ph 4 жыл бұрын
When IF statement is TRUE you return a string, but when IF statement is FALSE you return nothing. And that's why this warning is shown, because there is a possible situation when you don't return anything. Simply after IF statement add 'else { return null }' and warning will be gone
@ArpitA5724
@ArpitA5724 4 жыл бұрын
@@hp666ph already did that
@ArpitA5724
@ArpitA5724 4 жыл бұрын
@@hp666ph then i used another example and implemented form validation easily
@chetanac85
@chetanac85 4 жыл бұрын
thank you!!it works
@amitkumarsahoo8280
@amitkumarsahoo8280 4 жыл бұрын
For validate the fields : if (value.isEmpty || double.tryParse(value) == null) { return 'Please provide Principal amount'; }
@chetantailor3620
@chetantailor3620 3 жыл бұрын
will you please elaborate this //double.tryParse(value)==null use?
@chaitanyadeshpande5517
@chaitanyadeshpande5517 3 жыл бұрын
inputFormatters: [FilteringTextInputFormatter.allow(RegExp("[0-9]+"))] Use this
@refreshing_morning
@refreshing_morning 6 жыл бұрын
Sir, when will you upload another video? Can't wait for database series to be out.
@smartherd
@smartherd 6 жыл бұрын
Soon
@meenubalakrishnan3213
@meenubalakrishnan3213 5 жыл бұрын
hi sir,i am new to flutter could you please tell me the answer for the assignment?(how to write a validation condition to check for number not string?)
@anilkumara6141
@anilkumara6141 5 жыл бұрын
check like this if (!isNumeric(value)) {
@Salehalanazi-7
@Salehalanazi-7 6 жыл бұрын
I can't wait for the next section!
@smartherd
@smartherd 6 жыл бұрын
Next section after 10 days. I came down to my hometown for durga puja
@JK92007
@JK92007 6 жыл бұрын
enjoy durga puja bro.....yes....common....
@venky4913
@venky4913 4 жыл бұрын
Third section successfully completed But clicking on the rupees or dollars it changes, but it appears blur screen on clicking Thank you so much ❤️
@lorenzomarin2856
@lorenzomarin2856 4 жыл бұрын
Really, you are the best!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Really thank you man. Thank you
@leticiapires1754
@leticiapires1754 5 жыл бұрын
Hi! I would like to sugest using ALT+ENTER to wrap the widget with your new widget, and to delete one. Because all stuff with parenteses become automatic[If you are using androidStudio]
@irfanansari6448
@irfanansari6448 5 жыл бұрын
can you please be more specific?
@danishdarren1179
@danishdarren1179 4 жыл бұрын
In visual studo code use shift +alt + F to restructure the code
@swarajdash5496
@swarajdash5496 6 жыл бұрын
Hello sir, thanks to you and GDG bbsr's workshop I've already learnt so much of Dart and Flutter. I never did any development in Android Studio with Java, xml etc and directly started with Flutter (and feel comfortable). So should I continue with Flutter or should I learn the usual way and do Flutter later?
@smartherd
@smartherd 6 жыл бұрын
It's okay. If u like flutter then continue with it
@hermenegildomatabeia8869
@hermenegildomatabeia8869 3 жыл бұрын
thank you and good job
@annyong1776
@annyong1776 5 жыл бұрын
Thanks, and.. validation dropdownbootom?
@hicnar
@hicnar 5 жыл бұрын
Make sure you add _formKey.currentState.reset(); line somewhere in your _reset() function :)
@idlevandal69
@idlevandal69 5 жыл бұрын
Thanks for that Chris. 🥇
@chandruganapathi2450
@chandruganapathi2450 4 жыл бұрын
thank you !!
@refreshing_morning
@refreshing_morning 6 жыл бұрын
Sir, is it compulsory to learn Server and web parts of dart? While learning flutter ?
@smartherd
@smartherd 6 жыл бұрын
As u proceed with flutter development, if it is needed then learn it. Else leave it
@senthilkumarp8314
@senthilkumarp8314 4 жыл бұрын
Nice tutorial, Assignment answer Inside TextFormField we need to restrict the text by using the code below TextFormField( inputFormatters: [WhitelistingTextInputFormatter.digitsOnly], )
@ibnulimtiaz5402
@ibnulimtiaz5402 3 жыл бұрын
This one is deprecated: inputFormatters: [WhitelistingTextInputFormatter.digitsOnly], this is new one inputFormatters: [FilteringTextInputFormatter.digitsOnly],
@krishnakumarramachandran5888
@krishnakumarramachandran5888 6 жыл бұрын
I created my First Flutter Application Succesfully.
@smartherd
@smartherd 6 жыл бұрын
That's awesome. Keep going
@raghavaarr4988
@raghavaarr4988 5 жыл бұрын
Hi sir, need examples on linq(i.e Where)
@amadougarbayoussoufa7056
@amadougarbayoussoufa7056 5 жыл бұрын
thanks Sir,This is a great tutorial good
@darish155
@darish155 6 жыл бұрын
Bhaiya naye videos kyon nahin daal rahe hain?
@smartherd
@smartherd 6 жыл бұрын
buddy, ghar aaya hu dussehra me. Have patience, will upload soon.
@darish155
@darish155 6 жыл бұрын
I asked it because I thought you are sick. Btw, enjoy your holidays!😊 And ya, thanks for replying! 😘
@priyankahegde6441
@priyankahegde6441 5 жыл бұрын
Awesome👏
@ericjonas6044
@ericjonas6044 6 жыл бұрын
Noticed you moved margin to a Padding widget instead Actually still confused.. it seems margin and padding are almost the same result?
@smartherd
@smartherd 6 жыл бұрын
It's not same. U can check my previous videos for differences. Also, while moving margin to padding I stated too why I am doing it
@ericjonas6044
@ericjonas6044 6 жыл бұрын
@@smartherd probably i need more practice to see the difference ;)
@chaitanyadeshpande5517
@chaitanyadeshpande5517 3 жыл бұрын
inputFormatters: [FilteringTextInputFormatter.allow(RegExp("[0-9]+"))] In your TextFormField, include this regex line. It will only accept digits from 0 to 9. If a character or symbol is entered by the user. That will not be shown.
@ramzanmubarak2591
@ramzanmubarak2591 5 жыл бұрын
what is form this video is not informated
@oussamaacharaf783
@oussamaacharaf783 4 жыл бұрын
thanks sir
@hasan8267
@hasan8267 6 жыл бұрын
nice work
@smartherd
@smartherd 6 жыл бұрын
Thanks
@smartherd
@smartherd 6 жыл бұрын
Thanks
@vzhen
@vzhen 5 жыл бұрын
I am from react native. Flutter looks so complicate to me. T.T
@Mahvendren
@Mahvendren 4 жыл бұрын
Well both uses State though....
@varadgauthankar
@varadgauthankar 4 жыл бұрын
I am form flutter. React native looks so complicate to me. T.T
@vzhen
@vzhen 4 жыл бұрын
Varad Gauthankar you r right. after 1 month learning flutter. It is so much better than rn.
@Solar546
@Solar546 6 жыл бұрын
WOW
@darish155
@darish155 6 жыл бұрын
Flutter ke
@OystaFX
@OystaFX 2 жыл бұрын
"The method 'validate' can't be unconditionally invoked because the receiver can be 'null'." Who can help me with this error, after writing if condition for formKey.currentState.validate()
@OystaFX
@OystaFX 2 жыл бұрын
Problem resolved. Had to assert the compiler with "!" after currentState in "formKey.currentState!.validate()", that the null condition has already been handled by the if condition we wrote under the Principal TextFormField.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
#11 - TextField and TextFormField #CodeAndroid #Flutter
12:54
CodeAndroid
Рет қаралды 92 М.
🎓📱 FULL Flutter Masterclass: Beginner to Pro
9:36:17
Mitch Koko
Рет қаралды 332 М.
Flutter Form Validation - Validate Login Form In Flutter Tutorials
14:27
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 911 М.
How to create and validate forms in Flutter
23:10
The Flutter Factory
Рет қаралды 111 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН