Open michaelspiss opened 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.
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.
Use case
Currently, flutter only supports square icons.
Icon
creates aSizedBox
with equal width and height. Packages like font_awesome_flutter, which contain rectangular icons, have to reimplement theIcon
class and change the line where flutter defines theSizedBox
. This leads to a lot of duplicate code, unnecessary maintenance costs, unexpected behavior for developers, and slow adaptation of new features added toIcon
.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:
IconData
which is then used to scale theIcon
width accordinglyIcon
which sets the icon dimensions (would keepFaIcon
in font_awesome_flutter)IntrinsicWidth
/IntrinsicHeight
(costly)~