timmaffett / material_symbols_icons

Complete Flutter support for google's Material DesignMaterial Symbols Icons
Apache License 2.0
32 stars 5 forks source link

Icons seem to be stuck at optical size 48? #24

Closed auradigitaldev closed 1 week ago

auradigitaldev commented 2 weeks ago

Installed this package, and the icons seem to be stuck at an optical size of 48, and even manually setting optical size via Icon(Symbols.draw, size: 24, opticalSize: 24) doesn't seem to have any effect.

Any help here would be greatly appreciated!

timmaffett commented 2 weeks ago

If you go to the example app https://timmaffett.github.io/material_symbols_icons/

The optical size slider appears to make the icons change. What platform are you using? You can run the example app for whichever platform and try it out. Any details you can provide will be helpful.

auradigitaldev commented 2 weeks ago

Oof this appears to be user error aha, I was feeding my icons through several layers of widgets and at one point I stripped the optical size out of the Icon class.

Works now, though the website and docs seem to suggest that optical size defaults to 24, whereas on Android it seems to default to 48 when left unspecified. Let me know if you prefer that I file a separate bug for this issue!

timmaffett commented 2 weeks ago

I see where the optical size default is listed as 24 on https://github.com/google/material-design-icons and I also checked within the truetype fonts and the default for optical size is 24.0 (and min 20.0 and max 48.0)

If the opticalSize is not specified explicitly in the Icon() call then the value from the IconTheme of the context is used:

If the default IconTheme doesn't have opticalSize specified then the font's internal default (24.0) should be used. You can dump the default icon theme's opticalSize in your android app, it must be 48.0...

(excerpt from icon.dart in flutter)

final IconThemeData iconTheme = IconTheme.of(context);

final double? iconOpticalSize = opticalSize ?? iconTheme.opticalSize;
auradigitaldev commented 1 week ago

Thanks Tim! You're right and I think this bug can be closed