Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal]Support for rectangular icons #99830

Open
michaelspiss opened this issue Mar 9, 2022 · 2 comments
Open

[Proposal]Support for rectangular icons #99830

michaelspiss opened this issue Mar 9, 2022 · 2 comments
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@michaelspiss
Copy link

michaelspiss commented Mar 9, 2022

Use case

Currently, flutter only supports square icons. Icon creates a SizedBox with equal width and height.
Packages like font_awesome_flutter, which contain rectangular icons, have to reimplement the Icon class and change the line where flutter defines the SizedBox.
This leads to a lot of duplicate code, unnecessary maintenance costs, unexpected behavior for developers, and slow adaptation of new features added to Icon.

Related issues: fluttercommunity/font_awesome_flutter#132, fluttercommunity/font_awesome_flutter#204, fluttercommunity/font_awesome_flutter#201, fluttercommunity/font_awesome_flutter#198

Proposal

There are multiple possible solutions:

  • Add an aspectRatio attribute to IconData which is then used to scale the Icon width accordingly
  • Allow overriding a method in Icon which sets the icon dimensions (would keep FaIcon in font_awesome_flutter)
  • Automatically obtain icon dimensions using IntrinsicWidth/IntrinsicHeight (costly)
@maheshmnj maheshmnj added the in triage Presently being triaged by the triage team label Mar 10, 2022
@maheshmnj
Copy link
Member

Hi @michaelspiss, Thanks for filing the issue. That looks like a valid proposal, I am labeling this issue for further insights from the team.

@maheshmnj maheshmnj added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: proposal A detailed proposal for a change to Flutter c: new feature Nothing broken; request for a new capability and removed in triage Presently being triaged by the triage team labels Mar 10, 2022
@maheshmnj maheshmnj changed the title Support rectangular icons [Proposal]Support for rectangular icons Mar 10, 2022
@michaelspiss
Copy link
Author

After doing some testing, the IntrinsicWidth/IntrinsicHeight approach seems to be way too costly to even be considered an option. Frames quickly drop below 7 on moderate scroll speed with a couple hundred icons (possible use case: icon picker), while staying above 40 with the aspect ratio approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests

3 participants