Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Fonts nit #227

Open
dickermoshe opened this issue Apr 7, 2024 · 3 comments
Open

Google Fonts nit #227

dickermoshe opened this issue Apr 7, 2024 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@dickermoshe
Copy link

As we know the Google Fonts package doent work well
material-foundation/flutter-packages#35

Could this either link to the workaround or be removed

// To use the Playground font, add GoogleFonts package and uncomment
// fontFamily: GoogleFonts.notoSans().fontFamily,
@famasf1
Copy link

famasf1 commented Apr 24, 2024

I think you could've made the issue a little clearer by describe the actual problem (like a background and suggesting the alternative.) instead of just throwing a link here and said 'it doesn't work well'.

GoogleFonts got recommended here simply because it is very easy to get things up and running. And giving out a nice example to work with quickly. if you have an alternative solution, You should purpose one up so the author can considering your request.

@dickermoshe
Copy link
Author

Sorry, I assumed Mike knows exactly what's going on here, this has been a pretty well known issue with Google Fonts on X, so I assumed everyone knew.

Background
The 1st Party GoogleFonts package doesn't include bold fonts, this is very common issue that many developers have spent hours pulling their hair out over.
In the Copy-Paste dialog on the Flex Color Scheme website the following text is included

// To use the Playground font, add GoogleFonts package and uncomment
// fontFamily: GoogleFonts.notoSans().fontFamily,

However, I propose that we shouldn't ignore the fact that this isn't as simple as it looks, or remove it

@rydmike
Copy link
Owner

rydmike commented Apr 26, 2024

Hi, @dickermoshe and @famasf1 thanks for taking an interest in the wondrous world of GoogleFonts and TextTheme 😄

I'm well aware of the challenges many face with setting up fonts using TextTheme and GoogleFonts. You can see one example on how I propose to do it in discussions here: #160

Where I show how to do it, to set it up so that you do get the correct weights as defined to actually be used and shown up in your TextTheme and app when using GoogleFonts.

Another interesting discussion about this can be found in this X/Twitter post and its many branches:

https://x.com/luke_pighetti/status/1759721848353288601

Where I give a few similar examples on what to do to make different weights work correctly.

Some links to that:
https://x.com/RydMike/status/1759746648832380954
https://x.com/RydMike/status/1759794570273882604

worth nothing is also, if you font does not contain the weights, you always only get poor approximations for those weights. All fixed fonts do not contain all weights.

You can find some interesting discussions in the thread here:

https://x.com/luke_pighetti/status/1759912133339259283

and here:

https://x.com/RydMike/status/1759920719121547306

While this is not something that is really a FlexColorScheme issue, or even a Flutter ThemeData issue, it is more like an issue of how to get GoogleFonts to load fonts from assets or the internet, but regardless of this, it is still something that I could very well add guidance and info for in the docs for FlexColorScheme.

After I have released version 8.0.0 I will be doing som overhaul of the docs. I will then add info about this this as well. I can then also include a URL link to the info in the copy/paste code about GoogleFonts usage.

Until then, I'm going to keep this issue open as reminder to improve the docs about this topic.


This is by the way also a little annoying bug in GoogleFonts and using its text theme feature: material-foundation/flutter-packages#401

And this one is about wrong color of primaryTextTheme in ThemeData flutter/flutter#118146

FlexColorScheme fixes and works around both those two issue. The primaryTextTheme wrong contrast color will probably never be fixed in Flutter, since the primaryTextTheme will probably be deprecated eventually.

@rydmike rydmike self-assigned this Apr 26, 2024
@rydmike rydmike added the documentation Improvements or additions to documentation label Apr 26, 2024
@rydmike rydmike added this to the 8.0.0 milestone Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: To do
Development

No branches or pull requests

3 participants