Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,210 --> 00:00:07,420
So what's causing this issue here which we also kind of saw when we added that keyboard?
2
00:00:07,430 --> 00:00:09,930
There we also have the strange warning.
3
00:00:09,950 --> 00:00:12,330
The problem is that this content is not scrollable.
4
00:00:12,860 --> 00:00:17,370
Let's understand how a column and by the way, also a row works by default.
5
00:00:17,390 --> 00:00:20,690
A column takes the full available height, a row the full available width
6
00:00:20,870 --> 00:00:25,510
but with that, of course I mean the height on the screen, not an infinite amount of height,
7
00:00:25,550 --> 00:00:29,160
it doesn't automatically add a scrolling functionality.
8
00:00:29,570 --> 00:00:34,730
That means that a column tries to squeeze all children it has into itself
9
00:00:35,420 --> 00:00:40,490
but if the child widgets have their own heights, like this one has, we define the height of a single
10
00:00:40,490 --> 00:00:46,700
transaction by the height of this box, by our font size and so on. So if these have a height
11
00:00:46,760 --> 00:00:53,890
which the column can't shrink, then at some point of time, the child widgets won't fit into the column anymore
12
00:00:54,260 --> 00:01:00,230
and then we need a solution and the solution is to add scrolling to the column and you can also add
13
00:01:00,230 --> 00:01:08,400
scrolling to a row. The fix is to go to our main.dart file and wrap the overall column that holds all
14
00:01:08,400 --> 00:01:11,190
our content on the page in a new widget.
15
00:01:11,190 --> 00:01:16,140
Now here is no predefined snippet for that but we can wrap it with a new widget and the widget we want
16
00:01:16,140 --> 00:01:21,490
to use here is a single child scroll view.
17
00:01:21,500 --> 00:01:27,490
Now this add some scrolling functionality to this column, which otherwise can't be scrolled and therefore
18
00:01:27,500 --> 00:01:35,520
now, you already see that we get no error here anymore when I open the keyboard, which is good.
19
00:01:35,540 --> 00:01:43,000
Now if I add a couple of transactions here real quick, so that we have too many transactions to squeeze
20
00:01:43,000 --> 00:01:46,300
them all into one column,
21
00:01:46,480 --> 00:01:54,150
then you see I can now scroll because single child scroll view adds scrolling functionality.
22
00:01:54,630 --> 00:02:00,130
Here's one important note, you have to add the single child scroll view on this level here so as the
23
00:02:00,130 --> 00:02:04,260
body element itself, it wouldn't work
24
00:02:04,260 --> 00:02:12,240
if you add single child scroll view only around user transactions or only inside of the transaction list
25
00:02:12,240 --> 00:02:12,380
here
26
00:02:12,390 --> 00:02:18,300
let's say, around this column. This would not work like this because a single child scroll view then wouldn't
27
00:02:18,300 --> 00:02:20,940
be able to set up scrolling correctly,
28
00:02:20,940 --> 00:02:26,240
it basically wouldn't be able to identify the container height in which it should scroll.
29
00:02:26,550 --> 00:02:35,030
What you can do however is you can not use single child scroll view here in the main.dart file,
30
00:02:35,030 --> 00:02:42,090
so remove that and remove that extra parentheses and instead in transaction list, you can wrap it with
31
00:02:42,180 --> 00:02:46,920
a container which you give a clearly defined height
32
00:02:46,920 --> 00:02:53,680
and important here is that you choose a height that does fit on the screen, like maybe 300,
33
00:02:53,730 --> 00:02:54,740
let's see,
34
00:02:54,750 --> 00:02:55,020
yes
35
00:02:55,080 --> 00:02:56,580
I'm not getting any warnings here,
36
00:02:56,580 --> 00:03:00,720
for example if I chose 500 here, I would get an error here
37
00:03:00,810 --> 00:03:06,030
and of course the available height depends on the device size. We'll later also have a look at how you
38
00:03:06,030 --> 00:03:08,360
can find out how much space is available
39
00:03:08,430 --> 00:03:14,010
but here on my emulator, just because I want to show this, if I work with 300 here, now we have a clearly
40
00:03:14,010 --> 00:03:16,650
defined container into which this column may go,
41
00:03:16,860 --> 00:03:22,740
so now that column does not size itself after the amount of space it needs for its children, instead
42
00:03:22,740 --> 00:03:26,220
it knows how much space it can take, 300 pixels
43
00:03:26,310 --> 00:03:30,360
and now you can wrap the column here with a single
44
00:03:33,750 --> 00:03:37,260
child scroll view and that single child scroll
45
00:03:37,260 --> 00:03:38,330
view now also knows
46
00:03:38,340 --> 00:03:43,580
that it must scroll inside of this 300 pixels box.
47
00:03:43,590 --> 00:03:48,870
So now here, we still get that warning however because I remove the overall scroll view on the entire
48
00:03:48,870 --> 00:03:55,140
page, which means that when the soft keyboard enters the page, the page doesn't know where to go
49
00:03:55,530 --> 00:03:58,620
but now we can scroll into that sublist down there.
50
00:03:58,620 --> 00:04:03,960
Now this can also be a useful pattern but in our app here, we definitely also need the scrolling on the
51
00:04:03,960 --> 00:04:11,630
entire list because we otherwise get that problem here where our soft keyboard actually pushes the
52
00:04:11,640 --> 00:04:19,770
page up a bit and that then leads to exceeded page boundaries. By the way, in detail what's happening
53
00:04:19,770 --> 00:04:28,100
here is that Flutter tries to always scroll the input, which we're editing into view and therefore it
54
00:04:28,160 --> 00:04:36,680
insets the page by the height of that text field, so that that text input can never be below that soft
55
00:04:36,680 --> 00:04:37,370
keyboard.
56
00:04:37,400 --> 00:04:41,650
It's not the case here but it could be below the soft keyboard on smaller devices,
57
00:04:41,660 --> 00:04:46,260
that's why the height of that text field is always added as a padding above the soft keyboard
58
00:04:46,340 --> 00:04:48,340
and that's exactly the problem we have here,
59
00:04:48,380 --> 00:04:55,370
that height is added here but since the page can't scroll away, we try to add height on a page that's already
60
00:04:55,370 --> 00:04:57,680
fully occupied with content.
61
00:04:57,680 --> 00:04:59,300
So that's the problem we have here
62
00:04:59,300 --> 00:05:06,390
and to avoid that, we definitely have to wrap our overall column here with a single scroll view, so
63
00:05:06,440 --> 00:05:08,960
there is no way around that.
64
00:05:08,990 --> 00:05:13,560
So here we have the single child
65
00:05:16,150 --> 00:05:23,050
scroll view around our overall column and now the entire page is scrollable, which leads to no visual
66
00:05:23,260 --> 00:05:25,210
difference when that keyboard opens up
67
00:05:25,210 --> 00:05:29,940
but technically there is a difference and we can see that by the way if we rotate the device.
68
00:05:30,160 --> 00:05:34,630
Now if I tap in here, you see that this gets scrolled up a bit by Flutter
69
00:05:37,850 --> 00:05:43,440
to make room for the keyboard and that is exactly what happens when we have a scroll view and
70
00:05:43,670 --> 00:05:45,780
what's not possible if we don't have one.
71
00:05:45,860 --> 00:05:50,030
It's a convenience feature by Flutter so that we can always reach our text input and see what we're
72
00:05:50,030 --> 00:05:56,450
entering but it only works if the page is scrollable for pages that are packed with content or on smaller
73
00:05:56,450 --> 00:05:57,420
devices.
74
00:05:57,440 --> 00:06:03,200
Well our list of transactions here also is scrollable because here, we still have our separate container
75
00:06:03,260 --> 00:06:04,540
with a single child scroll view
76
00:06:04,640 --> 00:06:09,470
which of course is something you could now also delete again but you can also leave it here.
8323
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.