eBay / flutter_glove_box

Various eBay tools for Flutter development
BSD 3-Clause "New" or "Revised" License
317 stars 64 forks source link

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

Open pietervp opened 3 years ago

pietervp commented 3 years ago

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...
coreysprague commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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

fzyzcjy commented 1 year ago

Hi, did you solve the problem? Thanks!

lsaudon commented 7 months ago

Same in release Android

image