Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,360 --> 00:00:05,210
Now added we added our theme here.
2
00:00:05,270 --> 00:00:08,690
Why don't we also add a custom fund.
3
00:00:08,690 --> 00:00:13,700
Because right now we always use the system default fund which is okay but in a lot of applications you
4
00:00:13,700 --> 00:00:19,220
of course want to bring your own textiles your own funds and adding custom fonts is very easy.
5
00:00:19,370 --> 00:00:21,120
In flutter apps.
6
00:00:21,210 --> 00:00:27,030
First of all you need to create a new folder in your project folder so not into lit folder but simply
7
00:00:27,030 --> 00:00:29,110
in your main project folder.
8
00:00:29,310 --> 00:00:31,410
You can name that folder whatever you want.
9
00:00:31,410 --> 00:00:37,230
Typically you name it something like assets or you directly name it funds whatever you want I'll name
10
00:00:37,230 --> 00:00:42,570
it assets and in the assets folder I'll create a funds folder you could as I just mentioned all to have
11
00:00:42,570 --> 00:00:44,250
the funds folder on the root level.
12
00:00:44,250 --> 00:00:47,120
But I want to have it here in the assets folder now there.
13
00:00:47,180 --> 00:00:52,260
I want to use a couple of funds and you'll find a zip file attached which includes the funds I will
14
00:00:52,260 --> 00:00:53,480
use here.
15
00:00:53,520 --> 00:00:59,340
So let's drag and drop the contents of that zip folder into that Fonts folder here.
16
00:00:59,760 --> 00:01:07,440
I brought in two funds here open sense in bold and the regular version and Quick send in a bold light
17
00:01:07,470 --> 00:01:12,030
medium and a regular version will actually not use all these versions but you can play around with them
18
00:01:12,300 --> 00:01:18,020
and we will definitely use both fonts open sense and quick said no with the fonts added here.
19
00:01:18,040 --> 00:01:24,580
We still can't automatically use them in our application to unlock them in our application and to include
20
00:01:24,580 --> 00:01:30,760
them in the in the app file that Flubber generates in the end you need to go to your pop aspect of the
21
00:01:30,770 --> 00:01:36,760
GMO file which again is your global management tool here and there if you scroll down you should actually
22
00:01:36,760 --> 00:01:44,530
find this commented out area which already gives you an example of how to add funds so you can simply
23
00:01:44,800 --> 00:01:50,590
comment back in by removing the hash symbols and then you'll see that you have funds which is indented
24
00:01:50,590 --> 00:01:57,920
by two spaces and again in Yemen default spacing matters and there you define a family key after this
25
00:01:57,920 --> 00:02:04,420
stash and a whitespace and that is the name of the fund this name here should match the name of your
26
00:02:04,420 --> 00:02:09,130
fund but theoretically it's up to you but of course to avoid confusion you typically give that the name
27
00:02:09,130 --> 00:02:10,180
of your fund.
28
00:02:10,180 --> 00:02:14,400
So for example here we have open sends now.
29
00:02:14,620 --> 00:02:18,940
You also need to define where the exact files for that fund can be found.
30
00:02:18,940 --> 00:02:24,430
You do this on a fund's key and then here with these asset keys and there you have to point at the folder
31
00:02:24,430 --> 00:02:33,050
which in our case is assets slash funds and then dare I have open sends that regular TAF.
32
00:02:33,070 --> 00:02:36,550
And here you absolutely need to get these file names correct.
33
00:02:36,550 --> 00:02:42,580
Make sure you don't miss type this path and this file name here has to match this path and file name
34
00:02:42,580 --> 00:02:43,920
here.
35
00:02:43,930 --> 00:02:51,610
Now I also have a bold version of this fund so we'll also add assets slash funds slash open sense dash
36
00:02:51,610 --> 00:03:00,460
bolt or ETF because that's my file name and my folder important to inform flutter that this is the bold
37
00:03:00,460 --> 00:03:01,250
version.
38
00:03:01,270 --> 00:03:08,140
It doesn't infer debt from the name you need to add a weight information here and the weight here is
39
00:03:08,140 --> 00:03:09,770
700 for this fund.
40
00:03:09,820 --> 00:03:14,860
If you're adding a new fund and you're downloading that from some resource like Google funds which is
41
00:03:14,860 --> 00:03:21,610
a web page then there you should find some information about which weight your fund has so open sends
42
00:03:21,610 --> 00:03:23,110
Bolt has a weight of 700.
43
00:03:23,110 --> 00:03:25,550
And therefore I add this extra information.
44
00:03:25,570 --> 00:03:31,340
This will become important later when we use fund weight bold in our flat or widgets and tell flutter
45
00:03:31,340 --> 00:03:36,790
that we want to use the bold fund 700 is treated as a bold fund and therefore flatter would pick this
46
00:03:36,790 --> 00:03:41,980
one no this is not the only fund to have the however not the only family.
47
00:03:42,050 --> 00:03:45,780
I'll add a second family here and that's called quicksand.
48
00:03:46,070 --> 00:03:55,010
And there again we add the funds key and in their asset and then assets slash funds slash quick Senate
49
00:03:55,250 --> 00:04:06,890
dash regular talk TGIF and then also asset assets funds quakes and dash bold dot ETF and there again
50
00:04:06,890 --> 00:04:10,780
all at the weight 700 annotation.
51
00:04:10,910 --> 00:04:14,040
Now you have q other funds which you could add which I'm not adding here.
52
00:04:14,060 --> 00:04:16,700
Of course if you are not using them you could delete them.
53
00:04:16,850 --> 00:04:22,130
But for you to play around feel free to add these other funds as well so that you can use them.
54
00:04:22,130 --> 00:04:27,200
That of course brings us to the question How can you use your own funds.
55
00:04:27,200 --> 00:04:32,900
Let's say we want to use quicksand as our normal global fund to the application.
56
00:04:32,900 --> 00:04:36,130
You can set such a global fund in your theme.
57
00:04:36,200 --> 00:04:41,810
So here in the theme data you can set a fund family and you can set this to quick send.
58
00:04:41,810 --> 00:04:47,670
Now of course the name you use here as a string has to match the name you have in your pups back that
59
00:04:47,680 --> 00:04:48,450
GMO fall.
60
00:04:48,470 --> 00:04:53,620
So if this year this family identifier is written as quick send the file names don't matter.
61
00:04:53,660 --> 00:04:58,800
But if this identifier is written like this then you have to write that exactly the same way when you
62
00:04:58,800 --> 00:05:00,380
are referring to it.
63
00:05:00,380 --> 00:05:06,540
Now with that you will have to quit your running process and actually restart it entirely.
64
00:05:06,560 --> 00:05:11,390
So pressing the refresh button also won't help you need to restart the app because we added new files
65
00:05:11,420 --> 00:05:16,490
to it and they are for you for the first time right after you edit the files you need to restart the
66
00:05:16,490 --> 00:05:22,400
app and once you did that once the app did restart you should see that your application why default
67
00:05:22,400 --> 00:05:29,290
font is quicksand which is a bit thinner than a default on Android which is Roberto.
68
00:05:29,310 --> 00:05:30,930
So here's my application.
69
00:05:30,930 --> 00:05:35,610
And as you can tell we now have a thinner fund and that is our quicksand fund.
70
00:05:35,610 --> 00:05:38,610
Now of course in some places you might still want to use a different fund.
71
00:05:38,670 --> 00:05:44,190
For example here for my titles I once used all the other fund the open sends fund at all and maybe here
72
00:05:44,460 --> 00:05:47,870
in the app bar there are two ways of doing that.
73
00:05:48,030 --> 00:05:54,420
You can go to your app bar if we want to start with that in the main dart fall and on the app are here
74
00:05:54,720 --> 00:06:02,580
on this text here in the title you could add a style and that would be a text style.
75
00:06:02,580 --> 00:06:08,060
And there you can set the font family and you can set that to open sense like this.
76
00:06:08,070 --> 00:06:13,250
If you do that and it saves you see now this is bolder because now it uses open sends.
77
00:06:13,430 --> 00:06:19,040
The downside of this is that if you had an application with multiple pages which we haven't here but
78
00:06:19,040 --> 00:06:25,010
we'll have it later in the course then you would have to add this style to every title to every text
79
00:06:25,010 --> 00:06:30,230
which is in every title of every app bar which is really redundant if you want to have the same style
80
00:06:30,230 --> 00:06:33,230
in every app bar across your entire application.
81
00:06:33,320 --> 00:06:41,690
Therefore you can also set a default app bar theme in your feed data there you can add app bar theme
82
00:06:42,740 --> 00:06:51,680
and now define a new app bar theme here where you set a text theme by using theme data dot light which
83
00:06:51,680 --> 00:06:57,020
is a set of defaults the defaults you'll normally have when you just create a theme data object.
84
00:06:57,020 --> 00:07:04,660
Now here we basically have that same theme that object with the default settings configured and on that
85
00:07:04,720 --> 00:07:12,460
theme data object using the light theme we can now access the text theme here and copy it with our own
86
00:07:12,460 --> 00:07:13,090
settings.
87
00:07:13,090 --> 00:07:19,570
So what we basically do here is we assign a new text theme for our app bar so that all text elements
88
00:07:19,600 --> 00:07:26,200
in the app bar receive that theme and we based it on the default text team so that we don't have to
89
00:07:26,200 --> 00:07:33,250
overwrite everything like font size and so on but we use the default text theme and copy that with some
90
00:07:33,250 --> 00:07:37,460
new overwritten values and here I overwrite that titles.
91
00:07:37,750 --> 00:07:41,650
Titles are a specific style of text flatter knows that.
92
00:07:41,650 --> 00:07:45,280
Titles receive a specific style.
93
00:07:45,280 --> 00:07:47,260
I want to give titles.
94
00:07:47,260 --> 00:07:55,990
A text style because title here expects a textile object where the fund family is let's say open sends
95
00:07:56,500 --> 00:08:01,980
and where it maybe even has a default font size of let's say 20 if you want to change that as well.
96
00:08:03,390 --> 00:08:10,350
Now with that we're using the basic text theme with our own settings mixed in and we apply that to all
97
00:08:10,350 --> 00:08:16,710
texts in the app bar theme or the app art in general and to be very precise we don't overwrite all text
98
00:08:16,710 --> 00:08:24,340
in there but text which is marked as a title by flutter and the title here is actually marked as such
99
00:08:24,340 --> 00:08:32,400
by flutter and I will show you how you can manually Mark items as title in a second so if you save that
100
00:08:32,410 --> 00:08:33,120
then you go back.
101
00:08:33,120 --> 00:08:37,390
You see this is no less bold because the default actually was bold.
102
00:08:37,410 --> 00:08:39,980
I now changed this to not be bold anymore.
103
00:08:40,020 --> 00:08:46,950
We can of course set this back to bold by adding font weight and then here font white dot bold again
104
00:08:47,310 --> 00:08:48,780
just to confirm that this works.
105
00:08:48,810 --> 00:08:49,780
Now it's bold.
106
00:08:49,980 --> 00:08:51,750
And now we are clearly using a different style.
107
00:08:51,750 --> 00:08:55,200
We're using open sense here not quicksand anymore.
108
00:08:55,260 --> 00:08:56,780
So this is working.
109
00:08:56,970 --> 00:09:03,870
And this is one way of also applying fonts here to all our app bars or to be precise to all title texts
110
00:09:03,960 --> 00:09:05,780
in app bars.
111
00:09:05,790 --> 00:09:12,890
Now I also want to make sure that all my other titles here are using this style.
112
00:09:12,900 --> 00:09:21,850
And how can we do that for it as we first of all need to inform flatter that our texts here should be
113
00:09:21,850 --> 00:09:23,090
treated as titles.
114
00:09:23,680 --> 00:09:29,640
So let's go to the transaction list and dear to our title which is here and there.
115
00:09:29,770 --> 00:09:39,170
What we can now do is instead of defining our own text style here we can also reference our theme with
116
00:09:39,170 --> 00:09:42,710
theme of context and then access the text theme.
117
00:09:42,800 --> 00:09:48,830
And here our title theme now at the moment when I save this does will use quick scent because remember
118
00:09:48,830 --> 00:09:55,760
that our title theme here is only defined for inside app bars and we could bring that out of the app
119
00:09:55,760 --> 00:09:57,730
or if you want that that same style everywhere.
120
00:09:57,730 --> 00:10:03,520
But I want a slightly different normal text theme and therefore here I can set up my own text theme
121
00:10:04,170 --> 00:10:11,630
justice as before however all copy it based on the existing text team so that that don't have to set
122
00:10:11,690 --> 00:10:13,180
everything in there.
123
00:10:13,190 --> 00:10:19,190
I want to set my own title theme by giving this now a globally available text style which all items
124
00:10:19,190 --> 00:10:21,960
that refer to this title theme will now use.
125
00:10:22,190 --> 00:10:33,200
And there we can set textile cue fun family open sense font weight font weight bold and a font size
126
00:10:33,200 --> 00:10:38,840
of say 18 and that's the difference to the app or font size where I have 20 Otherwise I could've used
127
00:10:39,350 --> 00:10:42,110
just one global title theme.
128
00:10:42,230 --> 00:10:45,890
Now I have a separate title theme for the app bar and one for the rest of the app.
129
00:10:46,010 --> 00:10:51,710
And I do refer to that by not providing my own tech style here but by referring to the globally available
130
00:10:51,710 --> 00:10:53,770
text theme titled text style.
131
00:10:54,650 --> 00:11:00,710
So if that if we now saved as we have our nice look here you using open sends and a bold text and the
132
00:11:00,710 --> 00:11:04,910
size of 18 for everything that is marked as a title with this approach.
14975
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.