Skip to content

[Proposal]Support for rectangular icons #99830

Description

@michaelspiss

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions