icon 2.1.0 copy "icon: ^2.1.0" to clipboard
icon: ^2.1.0 copied to clipboard

outdated

An extended Icon for those that are not actually square, plus shadows support.

🙋‍♂️ I'm an IconToo! #

An extended Icon for those that are not actually square, plus shadows support. #

Screenshot preview of Icon Example appScreenshot preview of Icon Example app

... because Flutter's native Icon "assumes that the rendered icon is squared" and that "non-squared icons may render incorrectly."

IconToo IconToo(IconData icon, {Size? trueSize, double? sizeX, double? sizeY, Color? color, List<Shadow>? shadows, AlignmentGeometry? alignment, TextDirection? textDirection, String? semanticLabel})
  • Support for AlignmentGeometry as IconToo.alignment is available.

    • But defaults to Directionality.of because it is trueSized by design
  • Note: trueSize parameter is a Size and not a double.

  • sizeX and sizeY are available for const construction with doubles
    • But not forwarded to [Icon]

❓ Example with IconButton: #

IconButton(
  icon: IconToo(
    color: Colors.red,
    CustomIcons.non_square_icon,
    // IconToo passes `fontSize = min(trueSize.width, trueSize.height)` to `TextStyle()`
    trueSize: Size(34.0 * 5, 34.0),
  ),
  // But we need the max() to ensure an IconButton has a diameter that encompasses the entire IconToo
  iconSize: 34.0 * 5,
  onPressed: () {},
);

Icon Utilities - IconUtils #

  • 📋 copyWith
  • operator *(dynamic operation)
    • operation is Color => this.copyWith(color:operation)
    • operation is double => this.copyWith(size: size ?? 0 * operation)
  • operator +(double inflate)
  • operator -(double deflate)

Icon Example #

See some example usage of the Icon package for Flutter included here.

11
likes
0
pub points
82%
popularity

Publisher

verified publisherzaba.app

An extended Icon for those that are not actually square, plus shadows support.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on icon