NearHuscarl / flutter_login

Provides login screen with login/signup functionalities to help speed up development
MIT License
1.5k stars 798 forks source link

Unnecessary font downloads on the Web platform #499

Open sashkent3 opened 2 weeks ago

sashkent3 commented 2 weeks ago

Describe the bug Using Cyricilic (possibly any non-ASCII) characters as LoginMessages.loginButton (and likely any other AnimatedButton.text) causes Flutter Web to download the fallback font Noto Sans SC.

The bug is caused by a TextStyle which doesn't copy the fontFamily from the theme here. For example, adding fontFamily: theme.textTheme.labelLarge!.fontFamily, to the TextStyle there resolves the issue for me, however in my opinion, it's wiser to use the whole theme.textTheme.labelLarge for the style here.

To Reproduce Steps to reproduce the behavior:

  1. Run the gist on the Flutter Web platform.
  2. Go to the Network tab of the Chromium's Developer Tools.
  3. Observe that both Roboto (the default font) and Noto Sans SC (one of the fallback fonts) are downloaded.

Expected behavior I expected only the Roboto font to be downloaded.

Screenshots image

Information (please complete the following information):