Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,420 --> 00:00:07,820
Now with the application taking a lot of shape, it's time to finally work on a chart because that's the
2
00:00:07,910 --> 00:00:11,850
ugly piece that really doesn't fit into our application at all.
3
00:00:12,410 --> 00:00:16,590
Now for that, let's add a new widget and I'll name it
4
00:00:16,590 --> 00:00:23,430
chart.dart file because it will in the end display a chart about our recent transactions and that
5
00:00:23,430 --> 00:00:29,490
can actually be a stateless widget because we won't need to change any data in there, it'll just output
6
00:00:30,060 --> 00:00:34,730
some visual data about the transactions we added to our app.
7
00:00:34,760 --> 00:00:38,480
I'll name the widget chart because in the end that is what it is
8
00:00:38,580 --> 00:00:45,350
and of course just as a side note, there are official charting packages or third-party charting packages
9
00:00:45,390 --> 00:00:49,430
you could add to Flutter projects if you need more complex charts
10
00:00:49,530 --> 00:00:58,110
but that basic chart which we'll build here or that basic output we'll build here won't need such a package
11
00:00:58,140 --> 00:01:04,110
but you can bring in such packages if you need more complex charting functionalities.
12
00:01:04,230 --> 00:01:07,800
Now what do we need in here or how do we build this chart now?
13
00:01:07,800 --> 00:01:15,240
I want to have that chart wrapped in a card and I'll give this card an elevation level of let's
14
00:01:15,240 --> 00:01:18,210
say 6 to have a nice drop shadow
15
00:01:18,210 --> 00:01:23,220
and on that card I also want to have a margin around so that there is some space around our chart. We
16
00:01:23,220 --> 00:01:25,980
can add that with EdgeInsets as you learned
17
00:01:25,980 --> 00:01:30,260
and I'll add a margin in all directions of let's say 20,
18
00:01:30,270 --> 00:01:33,260
we can always shrink that down if it's too much.
19
00:01:33,270 --> 00:01:37,440
Now of course we need a child and that will be our actual chart
20
00:01:37,620 --> 00:01:44,990
and for that, let's again analyze how such a chart should look like. It's time for my awesome drawing
21
00:01:44,990 --> 00:01:46,380
skills again.
22
00:01:46,520 --> 00:01:54,590
So in our application here right, we'll have that chart area here at the top
23
00:01:54,590 --> 00:02:00,080
and my idea here is that we have a couple of bars let's say for the last seven days,
24
00:02:00,320 --> 00:02:04,490
so let's see if I can squeeze seven bars in here,
25
00:02:04,490 --> 00:02:05,260
yes almost.
26
00:02:05,270 --> 00:02:11,810
So we have seven bars here, one for each day in the last week, with some labels for the weekdays, so Monday,
27
00:02:11,810 --> 00:02:15,430
Tuesday, Wednesday and so on,
28
00:02:15,460 --> 00:02:23,160
so a single character for the weekday below that and above the amount of dollars that we spend on the
29
00:02:23,160 --> 00:02:26,300
day, which can be zero if we spend nothing or
30
00:02:26,440 --> 00:02:27,570
a different amount
31
00:02:27,580 --> 00:02:37,400
if we spend something and then in that chart, I want to have or in that bar, I want to have some indication
32
00:02:37,580 --> 00:02:44,330
of how much that amount that we spent on that day is of the total amount we spent on the overall week.
33
00:02:44,330 --> 00:02:52,400
So if we spend 50 on Monday and 30 on Tuesday and 0 on all other days, then we had a total spending of
34
00:02:52,490 --> 00:02:54,510
80, 50 plus 30
35
00:02:54,560 --> 00:02:59,110
and here we have $50 of $80,
36
00:02:59,150 --> 00:03:04,700
so we might have something like this, a significant amount above 50% of the bar
37
00:03:04,700 --> 00:03:08,660
and here we might have $30 of $80 total spending,
38
00:03:08,660 --> 00:03:11,540
so we're around a third of that bar.
39
00:03:11,540 --> 00:03:14,700
That's my idea of how this should be structured.
40
00:03:14,780 --> 00:03:21,160
Now what will we need here? This here, the red part,
41
00:03:21,180 --> 00:03:22,170
that's our card,
42
00:03:22,170 --> 00:03:24,500
we already have that.
43
00:03:24,530 --> 00:03:26,750
Let me pick a different color, blue.
44
00:03:26,750 --> 00:03:28,400
Now in that,
45
00:03:31,120 --> 00:03:37,070
we'll certainly need a row and of course, that row does not go beyond the boundaries of the card,
46
00:03:37,070 --> 00:03:39,050
I'm just drawing it like this so that you can see it,
47
00:03:39,380 --> 00:03:45,980
so we need a row here for our different bars. Each bar,
48
00:03:48,710 --> 00:03:59,810
so each bar here is then a column because we have the dollar sign, then the bar itself and then the label
49
00:04:00,500 --> 00:04:03,260
and the bar inside of the bar so to say,
50
00:04:03,380 --> 00:04:11,300
so that part here where we have that yellow filling, that of course again will be a container with a
51
00:04:11,300 --> 00:04:12,600
partial background,
52
00:04:12,590 --> 00:04:18,360
we'll see how we can draw, how we can fix this, how we can build this in Flutter.
53
00:04:18,410 --> 00:04:19,460
So that's the rough layout,
54
00:04:19,460 --> 00:04:20,420
let's now build that.
5434
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.