Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,190 --> 00:00:09,600
To round up this application as it currently is before we dive into responsiveness to make it look
2
00:00:09,600 --> 00:00:12,270
good on other device sizes and to make it look good on
3
00:00:12,300 --> 00:00:19,650
iOS, I want to revisit this list of transactions because at the moment, I feel like it looks a bit cutoff,
4
00:00:19,650 --> 00:00:23,190
both on the top and at the bottom.
5
00:00:23,190 --> 00:00:29,970
Now first of all to make sure it looks better on the bottom, here on our transaction list widget, we can
6
00:00:29,970 --> 00:00:34,400
of course do something to change the height of this container.
7
00:00:34,410 --> 00:00:41,130
Keep in mind that this transaction list widget is used in our main.dart file, in our state class there,
8
00:00:41,520 --> 00:00:47,260
here as part of this column where we have the chart and then the transaction list.
9
00:00:47,280 --> 00:00:53,850
Now you learned what you can do to make sure that this takes all the height it can get in this container,
10
00:00:53,850 --> 00:01:01,110
in this column I should say. We can wrap it with flexible and Flexfit.tight or therefore also just
11
00:01:01,110 --> 00:01:07,650
with expanded. We can even wrap expanded here around our transaction list widget as we use it here or
12
00:01:07,830 --> 00:01:12,730
since that's basically the same, inside of the transaction list around that container
13
00:01:12,840 --> 00:01:19,500
because in both cases, it's the direct child of this column then, our widget here is just a wrapper around
14
00:01:19,500 --> 00:01:22,380
these other widgets which are actually printed to the screen,
15
00:01:22,380 --> 00:01:24,380
so therefore it's the direct child
16
00:01:24,390 --> 00:01:30,540
either way. I'll use it here, since we can then immediately see that it belongs to this column here and
17
00:01:30,540 --> 00:01:36,680
therefore, I'll wrap this in and expanded widget here, my transaction list and
18
00:01:36,690 --> 00:01:45,380
if we save that, we now get an error though. We get an error which basically means that it's having problems
19
00:01:45,440 --> 00:01:46,880
expanding here
20
00:01:46,880 --> 00:01:49,040
and why is it having these problems?
21
00:01:49,040 --> 00:01:55,490
It has these problems because in the transaction list, we have our ListView here
22
00:01:55,490 --> 00:02:00,690
and as you learned earlier in this module, the ListView has an infinite height and
23
00:02:00,780 --> 00:02:07,010
that means that if we have various items, various transactions, the ListView is configured or is always
24
00:02:07,010 --> 00:02:12,200
configured to have an infinite height and if we have transactions, we display this ListView of course
25
00:02:12,230 --> 00:02:16,370
and previously we controlled that with height 300 here.
26
00:02:16,370 --> 00:02:22,550
Now that height of this container is overwritten by our expanded widget which wraps our transaction
27
00:02:22,550 --> 00:02:26,370
list and which therefore wraps this container with height 300
28
00:02:26,390 --> 00:02:32,390
and as you also learned earlier in the course, expanded forces the child to take all the available
29
00:02:32,540 --> 00:02:33,800
height it can get,
30
00:02:33,800 --> 00:02:35,660
in this case in a column.
31
00:02:35,660 --> 00:02:44,300
Now if we force a child to take all the height it can get and our child in the end is a ListView which
32
00:02:44,510 --> 00:02:46,090
takes an infinite amount of height,
33
00:02:46,100 --> 00:02:48,500
then we have exactly the problem we have here,
34
00:02:48,560 --> 00:02:53,510
we're telling it take all the height you can get, all the available space and at the same time our child
35
00:02:53,510 --> 00:02:59,360
says okay I take everything, I take an infinite amount of height and these two pieces of information don't
36
00:02:59,480 --> 00:03:03,670
fit together, which is why we can't reuse expanded there.
37
00:03:03,890 --> 00:03:12,830
What could we do though to still make sure that we take the available remaining space here with our list
38
00:03:12,830 --> 00:03:13,740
view?
39
00:03:13,910 --> 00:03:20,110
Well we'll later, in the next section, learn about a way of calculating how much height we have
40
00:03:20,110 --> 00:03:29,390
available and then we can manually calculate pixel values, percentage shares of that total height to use
41
00:03:29,390 --> 00:03:35,840
a fixed height on our container here but actually derive that fixed height dynamically on the available
42
00:03:35,840 --> 00:03:40,880
height which we're now trying with expanded but expanded works a bit differently, it's not setting a
43
00:03:40,880 --> 00:03:47,600
fixed pixel height, it's telling the child please take all the available space. Later when we can
44
00:03:47,600 --> 00:03:53,060
calculate a fixed height but change that fixed height depending on the viewport height, then we'll have
45
00:03:53,240 --> 00:03:59,450
a tool to make sure that we can actually take up the available space and at the same time, not run into
46
00:03:59,450 --> 00:04:07,010
this issue. For the moment, we can't do this and therefore, we'll have to set a fixed height and so
47
00:04:07,010 --> 00:04:13,490
to simply have a bit of a better looking app right now, I'll set a fixed height of 400 here, which means
48
00:04:13,490 --> 00:04:20,690
that here now this is getting cut off a bit further down and we can kind of maybe use 450 and of course
49
00:04:20,690 --> 00:04:24,020
this now only looks good on this device.
50
00:04:24,080 --> 00:04:25,690
That's the problem here
51
00:04:25,880 --> 00:04:30,440
and if we had a bigger or smaller device, it would not look good but that's exactly what we'll tackle
52
00:04:30,440 --> 00:04:36,740
in the next course section where we will actually not hardcode this to find a value that works for this
53
00:04:36,740 --> 00:04:43,700
device but where we can exactly calculate this for all kinds of device screens. Still, for this device, this
54
00:04:43,700 --> 00:04:49,940
now looks better and I hope it's clear or I could convey what the issue here is with expanded and the
55
00:04:49,940 --> 00:04:55,750
ListView. With that, I think the app is looking good, we can certainly work with that,
56
00:04:55,770 --> 00:05:02,930
let's add one other transaction to see whether everything is working correctly with our changed list
57
00:05:02,930 --> 00:05:05,680
height here. If I do this,
58
00:05:05,680 --> 00:05:06,720
yes we can scroll here,
59
00:05:06,740 --> 00:05:11,900
we can scroll the overall page of course, that only scrolls the size of the chart in this bottom container
60
00:05:11,930 --> 00:05:13,250
however and in that container,
61
00:05:13,250 --> 00:05:16,200
we then have an extra scroller with our list.
62
00:05:16,430 --> 00:05:19,850
So that is all looking good, is all working great as it should,
63
00:05:19,850 --> 00:05:23,510
we can delete items that's also working. With that,
64
00:05:23,510 --> 00:05:29,000
that's it for this module and we'll next have a look at how we can adjust this in a more flexible way
65
00:05:29,000 --> 00:05:31,910
to different device sizes and to different platforms.
7549
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.