flutter_glove_box icon indicating copy to clipboard operation
flutter_glove_box copied to clipboard

[golden_toolkit] [flutter_web] Roboto font is added to FontManifest in release mode

Open pietervp opened this issue 3 years ago • 5 comments

When running the release build of a Flutter Web App, we didn't expect the dev_dependency golden_tookit to be adding a Font dependency. Is this the expected behavior, or could we configure our application to behave differently? The goal is to download as less files as possible, especially files we will never use when running the app, like this one.

One option is to not include the tests inside the application package, and have a separate test project for golden tests. Downside is that we have to export internal Widgets we want to test.

FontManifest.json:

[
   {
      "family":"packages/golden_toolkit/Roboto",
      "fonts":[
         {
            "asset":"packages/golden_toolkit/fonts/Roboto-Regular.ttf"
         }
      ]
   }
]

This behavior might be related to us configuring our pubspec.yaml like this:

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: false

Doing this, the build output reports following message:

Launching lib\main.dart on Chrome in debug mode...
package:golden_toolkit has `uses-material-design: true` set but the primary pubspec contains `uses-material-design: false`. If the application needs material icons, then `uses-material-design`  must be set to true.
Waiting for connection from debug service on Chrome...

pietervp avatar Sep 09 '21 06:09 pietervp

Interesting. I'll need to look into this. I would have thought that tree shaking would have kept the font from actually being shipped since it is a dev_dependency

coreysprague avatar Sep 09 '21 15:09 coreysprague

Sorry for the delay here... I am finally looking into this. the "uses-material-design" property from golden_toolkit will be removed. It was there to assist in some internal tests, which can be moved out to our example package.

Need to give a bit more thought to the roboto font though. If we don't bundle it, every consuming package will need to bundle it themselves if they don't want the blocky Ahem font.

coreysprague avatar Oct 15 '21 16:10 coreysprague

https://github.com/flutter/flutter/issues/79261

coreysprague avatar Oct 15 '21 16:10 coreysprague

Hi, did you solve the problem? Thanks!

fzyzcjy avatar Apr 06 '23 01:04 fzyzcjy

Same in release Android image

lsaudon avatar Jan 24 '24 09:01 lsaudon