Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,230 --> 00:00:07,720
I'm quite happy with our current state but in the transaction list as I mentioned, of course you can
2
00:00:07,720 --> 00:00:10,730
keep your custom list item here which we built
3
00:00:10,750 --> 00:00:20,250
if you prefer that, I want to show you an alternative though and that alternative, here instead of using
4
00:00:20,310 --> 00:00:30,130
a card with our custom stylings and our custom setup, that alternative is a widget built into Flutter
5
00:00:30,640 --> 00:00:34,960
which you often use in conjunction with lists but you don't have to use it in conjunction
6
00:00:34,960 --> 00:00:42,250
and that would be a ListTile widget. Again, that's built into Flutter and that's a nicely preconfigured
7
00:00:42,640 --> 00:00:49,490
and styled widget with a certain layout that fits particularly well into lists. On your list
8
00:00:49,530 --> 00:00:51,360
tile, you can set up a couple of things,
9
00:00:51,400 --> 00:00:56,440
for example you can set up a leading widget which means a widget that is positioned at the beginning
10
00:00:56,590 --> 00:00:58,600
of that ListTile
11
00:00:58,600 --> 00:01:00,790
and there, we could use yet another built-in widget,
12
00:01:00,790 --> 00:01:09,190
the CircleAvatar, which is a rounded widget that can hold a content often, it's used to hold images but
13
00:01:09,190 --> 00:01:12,830
here we'll use it to hold our amount spent
14
00:01:13,120 --> 00:01:15,520
and it simply looks nice.
15
00:01:15,520 --> 00:01:23,380
So here, we can assign a radius of let's say 30, that defines how rounded it is and give it a child and
16
00:01:23,380 --> 00:01:29,360
that child here can be our text with our transaction amount.
17
00:01:29,380 --> 00:01:34,690
So again, here using a dollar sign which we want to output and therefore which we escape and then a dollar
18
00:01:34,690 --> 00:01:45,670
sign for our string interpolation where I use transactions for the given index and there, the amount
19
00:01:48,330 --> 00:01:55,730
and if we save that, now our list items look like this. For very long numbers, it's not looking that great
20
00:01:55,760 --> 00:01:58,760
and therefore, you learned what we can do,
21
00:01:59,040 --> 00:02:04,480
we can wrap this with a new widget and that could be our FittedBox here
22
00:02:04,650 --> 00:02:11,150
and if we wrap that with a FittedBox, now longer items shrink a bit.
23
00:02:11,190 --> 00:02:17,700
Now still some spacing would be nice and therefore we can then also wrap our FittedBox here with
24
00:02:18,180 --> 00:02:28,480
another widget, with a padding widget and give it a padding of let's say EdgeInsets.all 10 maybe,
25
00:02:30,270 --> 00:02:31,360
a bit too much,
26
00:02:31,360 --> 00:02:32,870
let's go with 6
27
00:02:32,950 --> 00:02:38,770
and yes, super big numbers really don't look that good but it's unrealistically huge number for
28
00:02:38,770 --> 00:02:39,160
this app,
29
00:02:39,160 --> 00:02:41,230
so this should be fine.
30
00:02:41,230 --> 00:02:47,020
So that's our leading part but of course that's not all that should be output on the ListTile.
31
00:02:47,350 --> 00:02:54,820
Besides the leading element, we can also have a title, which is an element in the middle and there, I'd
32
00:02:54,820 --> 00:03:04,920
like to have my text with my transaction title. Now we can also set a style and again, I'll get that style
33
00:03:04,920 --> 00:03:07,560
here from my theme.
34
00:03:07,560 --> 00:03:09,920
So here I want to get my text theme and there,
35
00:03:09,930 --> 00:03:14,790
the title theme and it's not i but index.
36
00:03:15,010 --> 00:03:20,380
If we add this here, this title assignment with our text widget using the title theme, then we have
37
00:03:20,380 --> 00:03:23,970
the title again. Besides the title,
38
00:03:23,970 --> 00:03:30,030
you can also add a subtitle to the list tile which is basically some text shown below the title.
39
00:03:30,030 --> 00:03:38,370
So here again I want to show some text and there, I'll refer to transactions index and then my date.
40
00:03:39,600 --> 00:03:41,270
Date of course is a datetime,
41
00:03:41,280 --> 00:03:48,630
I want to have a human readable date and therefore here, I'll use date format for this formatted with a year,
42
00:03:48,750 --> 00:03:56,460
a long month and then a day and then I call format and pass that date as a value to generate a string
43
00:03:56,460 --> 00:04:04,910
based on that date and with this adjustment, we now have the date below that and you're hopefully seeing
44
00:04:04,910 --> 00:04:07,010
how this is taking shape.
45
00:04:07,110 --> 00:04:14,010
Now we could even add a trailing element, so an element at the end of that ListTile and often there you
46
00:04:14,010 --> 00:04:19,410
have buttons, icon buttons like a trash icon for deleting the item and so on
47
00:04:19,620 --> 00:04:27,340
but for here, the only thing I want to do here, I want to wrap this into a card
48
00:04:27,340 --> 00:04:33,750
actually and on that card, I'll set up some margin in all directions,
49
00:04:33,980 --> 00:04:42,110
actually not in all directions but symmetrically in the vertical direction 8 and in the horizontal direction,
50
00:04:42,110 --> 00:04:48,500
maybe 5, a bit less, so there is some spacing between the list items as well and a little background color
51
00:04:48,950 --> 00:04:52,980
and I'll also add an elevation of 5 here to every card.
52
00:04:53,060 --> 00:04:58,700
And now with that, this is how the transactions look like, not too shabby and up there,
53
00:04:58,760 --> 00:05:04,690
we have our chart. Now of course, feel free to fine tune this a bit more if you prefer a different look,
54
00:05:04,730 --> 00:05:09,290
I will also revisit the general layout, for example that we have this empty space down there, I'm not
55
00:05:09,290 --> 00:05:14,600
too happy about that. We'll fix this later once we learned how to work with the device size and how to
56
00:05:14,600 --> 00:05:19,790
find out how big the device is we're running on. For the moment, let's leave it as it is and let's indeed
57
00:05:19,790 --> 00:05:25,310
have a look at how we can adjust our app to different device sizes and also to different operating systems,
58
00:05:25,490 --> 00:05:27,260
namely Android and iOS.
6603
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.