flutter_login icon indicating copy to clipboard operation
flutter_login copied to clipboard

Unnecessary font downloads on the Web platform

Open sashkent3 opened this issue 6 months ago • 1 comments

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):

  • Platform: web
  • Flutter version: 3.24.1
  • Package version: 5.0.0

sashkent3 avatar Aug 26 '24 14:08 sashkent3