ExpansionPanelList and ExpansionPanel

7 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.13
You save:  €36.89
List Price:  £110.03
You save:  £31.44
List Price:  CA$192.03
You save:  CA$54.87
List Price:  A$211.59
You save:  A$60.45
List Price:  S$189.02
You save:  S$54.01
List Price:  HK$1,093.71
You save:  HK$312.51
CHF 91.46
List Price:  CHF 128.06
You save:  CHF 36.59
NOK kr1,061.82
List Price:  NOK kr1,486.60
You save:  NOK kr424.77
DKK kr688.17
List Price:  DKK kr963.46
You save:  DKK kr275.29
List Price:  NZ$229.08
You save:  NZ$65.45
List Price:  د.إ514.18
You save:  د.إ146.92
List Price:  ৳16,474.51
You save:  ৳4,707.34
List Price:  ₹11,636.17
You save:  ₹3,324.85
List Price:  RM659.56
You save:  RM188.46
List Price:  ₦202,985.50
You save:  ₦58,000
List Price:  ₨39,085.72
You save:  ₨11,168.14
List Price:  ฿5,135.45
You save:  ฿1,467.37
List Price:  ₺4,513.94
You save:  ₺1,289.79
List Price:  B$720.20
You save:  B$205.78
List Price:  R2,573.67
You save:  R735.38
List Price:  Лв252.56
You save:  Лв72.16
List Price:  ₩191,210.73
You save:  ₩54,635.53
List Price:  ₪513.93
You save:  ₪146.84
List Price:  ₱8,148.95
You save:  ₱2,328.44
List Price:  ¥21,975.49
You save:  ¥6,279.16
List Price:  MX$2,337.44
You save:  MX$667.89
List Price:  QR512.15
You save:  QR146.33
List Price:  P1,899.46
You save:  P542.74
List Price:  KSh18,548.67
You save:  KSh5,300
List Price:  E£6,600.72
You save:  E£1,886.05
List Price:  ብር8,069.29
You save:  ብር2,305.67
List Price:  Kz119,054.91
You save:  Kz34,018.12
List Price:  CLP$127,353.10
You save:  CLP$36,389.20
List Price:  CN¥995.31
You save:  CN¥284.39
List Price:  RD$8,255.53
You save:  RD$2,358.89
List Price:  DA18,823.05
You save:  DA5,378.39
List Price:  FJ$317.44
You save:  FJ$90.70
List Price:  Q1,091.28
You save:  Q311.81
List Price:  GY$29,398.65
You save:  GY$8,400.21
ISK kr13,807.61
List Price:  ISK kr19,331.21
You save:  ISK kr5,523.60
List Price:  DH1,396.96
You save:  DH399.16
List Price:  L2,483.42
You save:  L709.60
List Price:  ден7,975.18
You save:  ден2,278.78
List Price:  MOP$1,129.51
You save:  MOP$322.74
List Price:  N$2,572.10
You save:  N$734.94
List Price:  C$5,169.58
You save:  C$1,477.13
List Price:  रु18,701.28
You save:  रु5,343.60
List Price:  S/524.20
You save:  S/149.78
List Price:  K545.83
You save:  K155.96
List Price:  SAR525.05
You save:  SAR150.02
List Price:  ZK3,718.29
You save:  ZK1,062.44
List Price:  L642.23
You save:  L183.50
List Price:  Kč3,193.44
You save:  Kč912.47
List Price:  Ft49,741.85
You save:  Ft14,212.97
SEK kr1,070.73
List Price:  SEK kr1,499.06
You save:  SEK kr428.33
List Price:  ARS$124,628.98
You save:  ARS$35,610.82
List Price:  Bs970.47
You save:  Bs277.29
List Price:  COP$536,293.92
You save:  COP$153,237.77
List Price:  ₡72,014.29
You save:  ₡20,576.98
List Price:  L3,470.95
You save:  L991.77
List Price:  ₲1,056,195.26
You save:  ₲301,791.63
List Price:  $U5,387.22
You save:  $U1,539.31
List Price:  zł550.04
You save:  zł157.16
Already have an account? Log In


Hello, in this video I am going to show you an expansion panel list and expansion panels inside an expansion panel listen basically a list of expansion panel. And expansion panel is from the bottom information, you can click and expand and it provides more information. So it's a great way of lifting up a list of item. But you know, maybe, if contact, for example, you have the name and phone number, and then if you click the expansion button, it could expand a bit equal provide you with a few and other items, such as a button for calling but for editing, now bit of extra information without actually opening up a dialog without going to another screen without opening anything else or expanding it. This isn't normal way of displaying information. So this is one of the more complex widgets, because you need to have a new class or an extra class.

And I'm just gonna call this my item and in here, we're gonna Have a constructor. And we're gonna set something by default. But before we do that, I need to create some variables we go expand. So this will work where we substandard or not, we need a final ring for the header, we can have more complex items and this simple. And if you understand what we do in this video, you should be able to go and in here and say this.is expanded along both. So by default, it's false.

Unless we specifically set it, we're going to see the header. This is going to be proof of this is being expected. And that's it for this now, in our own school, my homepage date. What we are going to do is create a list of those items. I'm going to call this underscore items can be equal to my I turn and now we can just sunstroke. This is pretty simple to co lawn to get rid of the error.

Now, in my item, open brackets, I'm going to say data. Data like and now we're gonna say body. And I put the body on say body. three instances of it, you can, again make the class more complex forms, keep it simple to upgrade, body to three. Now we can construct our application to be displayed. So we don't want a scaffold.

What we want is if we get rid of this, we get rid of it. We want to a view Yeah, you missed visas checking the deleted wanted to. And for me Hold on here you can add a few different properties. But we're just going to be dealing with the tool to basically put the ListView inside of something and I'm going to keep it simple and This replaces scaffold with it. And this ListView has children inside of it. And this is basically you know where we're going to be pulling our expansion so say banshan list and the expansion list is going to have an expansion callback.

A couple of variables, record from the back end index, and another Boolean for the plan this basically not and we're going to be using all locked in here. We're going to set state, I'm going to say underscore items, we're going to get that particular index. And this set is expanded to not true or false but to what it is currently but the opposite of it. So we're going to notice like it's already open and we click it is going to go to the opposite was a false and vice versa. So items in necklace can get expanded again, but because we've done the NOT operator, it will be the inverse. Now what we need to do is essentially add the children whose toy term dog dot map and is my item item, curly braces and need to do.to list and besides the element of return and you know, regularly Expansion panel.

Ban new isn't required on the latest version not to adopt new llaman transmission power open brackets, and we need a semi colon. Inside of here, we're going to say header builder, we're going to be constructing the header. We're going to keep this simple. Build a context, context, boom, expanded, again, expanded on that turn text. We're going to just say item dot headers, this will basically go over a loop over all the items in here, so we don't have to manually add them one by one, we just put them here. And again, it can be more complex than this.

It could have more variable most essentially but should be all good to go once you got everything from this video. So what we need, we got the The builder. Yeah. Now what we need to do is expanded it basically set to the expanded of the item. And finally, at the bottom of the body, it's gonna be a container. And inside of your child, again, you know, is the body know, you can add a child and any sort of child you want, you can customize it.

And obviously, you can do alignment, color, height, all of that stuff. And it's totally up to you. But I'm gonna keep it in a text item. You could be more complex than this. And I'm gonna say item dot body. Hot reload that.

Let's see, well, yeah, it's hot reload is added the free item. So if I open it, Scott body 32 and, again, you can customize the look and feel of it the color, I recommend that you do that you can combine your rows, columns, all of that good stuff. You could put this inside of something else totally up to you. If you have any questions, feel free to drop me a message. And as usual, I look forward to seeing you in 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.