Date and Time Picker in Flutter | Tutorial...

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
w [Music] hello and welcome to this new video today's video is going to be short and simple where we are going to create a date and time picker and flutter to create a date and time picker we are using text field so let's create two text field with some basic UI if you know the basic flutter UI development then you can skip this part and move to the next section [Music] he [Music] the basic text field is completed now let's make two text editing controller for each time and date picker text field and provide them [Music] now let's do the time picker thing inside the ontap method of time picker text field we create one variable to store the pick time and we call the method Showtime picker inside this method we have context and initial time for context we pass context and for initial time we pass current time using time of day. now and also we make this method async and add a [Music] weit and then if the pick time VAR variable is not null we pass that time to the respective text editing [Music] controller time picker field field is working fine now let's do the date [Music] picker as we did before we use the ontap function of text field and inside we call the show date picker method first we make a date time variable to store the pick date and the question mark says that the variable may be null and allow to safely access Properties or call methods inside the show date picker method we have context which takes context and we we have initial date which takes current date using datetime.now and we have first date where we assigned the year before 2000 like 1950 and finally last date where we assign a year after 2024 like 2,100 and also like previous method this is also async method and we add a we before [Music] it and then if the datetime variable is not null then we store the pick date in a new string variable by formatting [Music] it but for formatting the date we need to install a new package to our project that is inl package then we import the package to our homepage and use it to format the date [Music] and then finally we pass that formatted date to the date picker text field [Music] controller the date picker is also working [Music] fine in this way we can implement the date and time picker in the project if you guys find this video helpful please do like the video and subscribe the channel That will be very helpful and amazing thank you see you again [Music]
Info
Channel: Roshan Lungali
Views: 223
Rating: undefined out of 5
Keywords:
Id: 36FLSQthI5M
Channel Id: undefined
Length: 7min 21sec (441 seconds)
Published: Thu May 02 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.