Time Picker

6 minutes
Share the link to this page
You need to have access to the item to view this lesson.
One-time Fee
List Price:  $139.99
You save:  $40
List Price:  €129.04
You save:  €36.87
List Price:  £109.87
You save:  £31.39
List Price:  CA$191.38
You save:  CA$54.68
List Price:  A$211.08
You save:  A$60.31
List Price:  S$189
You save:  S$54
List Price:  HK$1,093.20
You save:  HK$312.36
CHF 91.55
List Price:  CHF 128.17
You save:  CHF 36.62
NOK kr1,058.18
List Price:  NOK kr1,481.49
You save:  NOK kr423.31
DKK kr688.07
List Price:  DKK kr963.32
You save:  DKK kr275.25
List Price:  NZ$228.68
You save:  NZ$65.34
List Price:  د.إ514.18
You save:  د.إ146.92
List Price:  ৳16,401.27
You save:  ৳4,686.41
List Price:  ₹11,627.39
You save:  ₹3,322.35
List Price:  RM658.58
You save:  RM188.18
List Price:  ₦204,567.22
You save:  ₦58,451.95
List Price:  ₨38,898.11
You save:  ₨11,114.54
List Price:  ฿5,122.47
You save:  ฿1,463.66
List Price:  ₺4,509.49
You save:  ₺1,288.51
List Price:  B$723.34
You save:  B$206.68
List Price:  R2,578.54
You save:  R736.77
List Price:  Лв252.26
You save:  Лв72.07
List Price:  ₩191,324.33
You save:  ₩54,668
List Price:  ₪512.25
You save:  ₪146.36
List Price:  ₱8,148.04
You save:  ₱2,328.18
List Price:  ¥21,970.73
You save:  ¥6,277.80
List Price:  MX$2,337.80
You save:  MX$667.99
List Price:  QR509.87
You save:  QR145.68
List Price:  P1,899.76
You save:  P542.82
List Price:  KSh18,247
You save:  KSh5,213.80
List Price:  E£6,597.01
You save:  E£1,884.99
List Price:  ብር8,034.09
You save:  ብር2,295.62
List Price:  Kz118,761.77
You save:  Kz33,934.36
List Price:  CLP$126,919.13
You save:  CLP$36,265.20
List Price:  CN¥995.39
You save:  CN¥284.42
List Price:  RD$8,234.17
You save:  RD$2,352.78
List Price:  DA18,822.49
You save:  DA5,378.24
List Price:  FJ$317.44
You save:  FJ$90.70
List Price:  Q1,086.15
You save:  Q310.35
List Price:  GY$29,254.27
You save:  GY$8,358.96
ISK kr13,818.61
List Price:  ISK kr19,346.61
You save:  ISK kr5,528
List Price:  DH1,394.74
You save:  DH398.52
List Price:  L2,480.57
You save:  L708.78
List Price:  ден7,947.19
You save:  ден2,270.78
List Price:  MOP$1,125.23
You save:  MOP$321.51
List Price:  N$2,569.81
You save:  N$734.28
List Price:  C$5,146.35
You save:  C$1,470.49
List Price:  रु18,594.99
You save:  रु5,313.23
List Price:  S/522.73
You save:  S/149.36
List Price:  K543.39
You save:  K155.26
List Price:  SAR524.93
You save:  SAR149.99
List Price:  ZK3,731.94
You save:  ZK1,066.34
List Price:  L642.02
You save:  L183.44
List Price:  Kč3,179.50
You save:  Kč908.49
List Price:  Ft49,522.43
You save:  Ft14,150.27
SEK kr1,066.73
List Price:  SEK kr1,493.46
You save:  SEK kr426.73
List Price:  ARS$124,662.49
You save:  ARS$35,620.39
List Price:  Bs966.19
You save:  Bs276.07
List Price:  COP$541,025.52
You save:  COP$154,589.76
List Price:  ₡71,687.89
You save:  ₡20,483.71
List Price:  L3,455.41
You save:  L987.33
List Price:  ₲1,051,715.43
You save:  ₲300,511.59
List Price:  $U5,381.10
You save:  $U1,537.56
List Price:  zł548.80
You save:  zł156.81
Already have an account? Log In


Hello, in this video, I am going to show you how to implement a time picker time picker. Simply put once trigger allows you to select a time. So this is great for me being an alarm reminder system, you know, a bunch of other scenarios as well on the other use cases come to mind, but I'm sure they do for you. If you want to know how to implement a date pickup, feel free to check the previous video for that. So outside of our scaffold our widget he has done for the class, we need to implement a couple of things. So we need to implement need to implement a time so we're going to say fine.

So with the time this will allow us to keep track of it, time of day, time of day. And this is gonna say equals So this is gonna be default on the set and I'm Do time of day dotnet you can overwrite or if you want to, but I'm going to keep it simple and just, you know, put the time that it is currently set to nav, whatever that time will be when we run it. Next, we need to have enough time all day. Know what time of day, actually now, we can use just this one today, we can just use the one. And what we want to do now is create a future a future note, and it's going to be a method that's going to be called once we trigger a wire an event is triggered, or maybe a button for example, I'm going to be implementing the button shortly.

And with the build context, on text. Inside of here, we are gonna say on photon equals show time. that's built in. Now on to the second Semi Pro lawn, and we are going to say the context is equal to the context that's being passed in. Next the other thing is the initial time, this is going to be set to the time so what is going on here? Okay, have a look underscore time equal await show time picker content.

Let me know. Thank you Call it picked and picked pennies on expected for you to have a wait. So let me make sure the future no build context needs to be asynchronous to learn about the async keyword so we can get rid of that we can train it back to on score time when we were kids make sure you don't make that mistake. And now we're going to say if pick is equal to null. So basically, long isn't equal to the current time, then we're going to trigger this event. Then I'm going to say set state.

So the set state is going to say point nine now equal to is now equal to actually now actually should be fine. Let's save that. Let me get rid of this. Let me save this and we are going to need a button. So we're going to need a button. So I'm gonna need a child icon but and for the child in you know we need an icon in here isn't going to be icon, icon long you can have any sort of icon or any sort of button.

They compress the ones that trigger this event my event select And this little context. Now I want to say after this, right? So if we was to refresh that, or we load it reload love the hot reload feature. I clicked that. So maybe, yeah, let's go to our click OK. As you see, there's a problem is this gets triggered straight away. So we don't want that.

And the way we can get around that is by not only here, by having time picked, I'm gonna say is equal to this. Then we're going to say sets date and time equals k. And then if it was between underscore time hot reload it now, as you can see doesn't print anything out. Yeah, let me go to this time. Okay, only Natalie get that and if I go back to it, I didn't see the status been maintained because we are storing it right here. And in terms of the one we would use, we would use this underscore time if we wanted to use it, you know, somewhere else. Maybe this is you know, minder, you click Save reminder, then he will use this to save the time.

That's it for the set time picker. If you have any questions, feel free to shoot me a message. And as usual, I look forward to seeing you on the next video.

Sign Up


Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.