How to use alternate fonts in flutter?

This Article is posted by seven.srikanth at 5/6/2020 2:42:58 AM



<p>font-size: 1rem;](In this article, I've explained how to use alternate fonts in Flutter.</p> <p>font-size: 1rem;](</p> <p>font-size: 1rem;](</p> <p>font-size: 1rem;](In flutter, we have 2 options to change the fonts.</p> <ul> <li>Use as a default app font.</li> <li>Use for a specific widget.</li> </ul> <p>But before that, you need to download the fonts from <a href="https://fonts.google.com/">https://fonts.google.com/font-size: 1rem;</a> or any other alternate location you know. And then add that to the pubspec.yaml file. Example below,</p> <p>Once added to the pubspec.yaml file, you are ready to use them in the app. So, let's explore the 2 options we have to change the fonts of the app.</p> <ol> <li>Use as a default app font.</li> </ol> <p>In order to change the default font of the app so that all the widgets can use the same fond, you need to set it as a fontFamily in side ThemeData. Example below,</p> <ol start="2"> <li>Use for a specific widget.</li> </ol> <p>In order to change the font of a specific Text widget, pass it through fontFamily property of TextStyle. Example below,</p> <p>If you want more fonts that are free for commercial use, check this link <a href="https://www.websiteplanet.com/blog/best-free-fonts/">https://www.websiteplanet.com/blog/best-free-fonts/target="_blankdata-saferedirecturl="https://www.google.com/url?q=https://www.websiteplanet.com/blog/best-free-fonts/&source=gmail&ust=1594431288632000&usg=AFQjCNFk5qWk4GU9C0Y31FuvULZclMspVgcolor: rgb(17, 85, 204); font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: rgb(255, 255, 255);</a></p> <p>Thanks, Srikanth</p>


Tags: alternate fonts; change default font;








0 Comments
Login to comment.
Recent Comments