Skip to content

How to use alternative themes of material icons #18384

Closed

Description

@hvkale

Google announced a bunch of updates to Material Guidelines during io2018. One of the updates is themes of material icons - https://material.io/tools/icons/
It now has "Filled", "Outlined", "Rounded", "Two-Tone", and "Sharp".

In Flutter, I know how to use regular icons which are "Filled" ones. I also know how I can add individual assets to the assets folder in Flutter app and use those in my code but I'd like if they were readily available so that you could use them like -

IconButton(
  icon: Icon(Icons.volume_up), // <=== Point of interest here
  tooltip: 'Increase volume by 10%',
  onPressed: () { setState(() { _volume *= 1.1; }); },
)

Looking at this repo I think it only supports default (Filled) right now but are there any plans to add other themes?

Probably

IconButton(
  icon: Icon(Icons.volume_up, theme: IconTheme.outlined), // <=== Example
  tooltip: 'Increase volume by 10%',
  onPressed: () { setState(() { _volume *= 1.1; }); },
)

Activity

  1. changed the title [-]How to use alternative variants of material icons[/-] [+]How to use alternative themes of material icons[/+] on Jun 12, 2018
  2. zoechi commented on Jun 12, 2018

    @zoechi
    Contributor
  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jul 22, 2018
  4. pgfepale commented on Sep 17, 2018

    @pgfepale

    Same question here... Need an outlined icon in a flutter.

  5. lucaslcode commented on Nov 6, 2018

    @lucaslcode

    I've made a package that lets you use the the 'outline' theme only: https://pub.dartlang.org/packages/outline_material_icons

  6. Cretezy commented on Nov 6, 2018

    @Cretezy

    I believe this is how it would be best implemented:

    Have new icons, such as Icons.volume_up_outline, etc. This would make it simple to implement, make all existing tooling work (i.e.: icon in gutter in IDE), and make it clear which icons have other themes (I do not think every icon is implemented in all themes).

    I believe we would need to update the tooling for generating the icons to allow other fonts, like using MaterialIconsOutline (instead of using the default MaterialIcons font). That would be at https://github.com/flutter/flutter/blob/master/dev/tools/update_icons.dart

    We also have a wiki page on editing the material fonts, which is a useful references: https://github.com/flutter/flutter/wiki/Updating-Material-Design-Fonts

    The OP's proposal of using IconTheme would conflict with https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/icon_theme.dart

  7. ThinkDigitalSoftware commented on Jan 10, 2019

    @ThinkDigitalSoftware
    Contributor

    I've made a package that lets you use the the 'outline' theme only: https://pub.dartlang.org/packages/outline_material_icons

    Thank you, sir. Using this

  8. lukepighetti commented on Jan 31, 2019

    @lukepighetti
    Contributor

    I would like to see the following material icons packs. The default ones are starting to look dated. The new packs are quite compelling.

    /// Leave the default ones intact so there are no breaking changes
    Icons.foo;
    
    /// Add new ones with new names
    FilledIcons.foo;
    OutlinedIcons.foo;
    RoundedIcons.foo;
    SharpIcons.foo;
    
    /// Not important to me, but it would be cool.
    TwoToneIcons.foo;
  9. added this to the milestone on Jan 31, 2019
  10. nt4f04uNd commented on Sep 21, 2019

    @nt4f04uNd
    Member

    Ahem, it's september 2019, nothing is done about this???????

  11. abbasnaqdi commented on Sep 22, 2019

    @abbasnaqdi

    +1

  12. willlarche commented on Sep 27, 2019

    @willlarche
    Contributor

    Work is currently underway to bring this functionality and additional optimizations for icons. Can't give a release estimate so in the meanwhile, I'd continue to get the icons you need as png assets from material.io if you're blocked. But it's a current priority.

  13. added
    customer: crowdAffects or could affect many people, though not necessarily a specific customer.
    c: new featureNothing broken; request for a new capability
    c: proposalA detailed proposal for a change to Flutter
    on Apr 22, 2020
  14. willlarche commented on Apr 22, 2020

    @willlarche
    Contributor

    #54923 is last dependent PR. Then we will update the icon font and consts!

  15. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  16. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions