flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.04k stars 27.2k forks source link

[Proposal]Support for rectangular icons #99830

Open michaelspiss opened 2 years ago

michaelspiss commented 2 years ago

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:

maheshj01 commented 2 years ago

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

michaelspiss commented 2 years ago

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.