Closed manuelcodigobase closed 2 years ago
Hi @manuelcodigobase,
Thanks for using flutter_charts and for this report. Let me ask a question with context: From this issue, I understand you are using the same font family throughout the app. Are you doing that using something like this:
return MaterialApp(
title: 'My App With My Fonts',
theme: ThemeData(fontFamily: 'MyCustomFont'),
home: const MyHomePage(),
);
?
If so, I am surprised flutter_charts do not pick it up in it's TextStyle. Can you please confirm, or describe how are you setting custom font family?
Once you confirm I will create a sample app and test it myself, then provide more useful help.
Separately, I also plan to add an example on how to override the ChartOptions
so clients can set TextStyle that way. But for that to work, I think I need to make a change in the code.
Thanks, Milan
Hello, again.
Yes, I'm setting custom from through the theme. In the same way that your show in your example.
Thank for responding so fast!
@manuelcodigobase : Thanks for the follow up.
The fact the custom font is not picked up from the application theme is very interesing. Thanks for the confirmation, I will look into it separately.
In the meantime, I prepared a change with an example, that allows flutter_charts ChartOptions to set it's own font on labels (which can be set by client to the same or different font as the app). I will release this during the weekend. There is a minor API change in that area, but the example should clarify how to use it.
Milan
@manuelcodigobase:
There is a new release 0.5.0, which should address this issue. Please take a look at
https://pub.dev/packages/flutter_charts
In particular the https://pub.dev/packages/flutter_charts/changelog and the example ex40LanguagesWithYOrdinalUserLabelsAndUserColors_lineChart
in https://pub.dev/packages/flutter_charts#orgc6be307 .
There are some API changes in the area, hopefully minor, all described in the changelog.
Please let me know if this works for you or if you have any issues.
Milan
You are amazing! Thank you so much!!
It works perfect!
@manuelcodigobase : Happy to hear it works for you. Thanks again for reporting,
Milan
Hi,
First, Thank you so much for this amazing packages. It's really good.
I've a problem with font family. In my theme, I'm using a custom font family, but the graph is not using it.
I've seen that there is a class called LabelCommonOptions, but there isn't a option to change font family. I've tried to wrap the LineChart class with a DefaultTextStyle widget, but it doesn't work too.
Is there any way to modify it?
Thanks.