icon 1.0.1+3 icon: ^1.0.1+3 copied to clipboard
An extended Icon for those that are not actually square. Plus shadows support!
🙋♂️ I'm an Icon Too! #
An extended Icon for those that are not actually square. Plus shadows support! #
... 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, Color color, List<Shadow> shadows, TextDirection textDirection, String semanticLabel})
-
Note:
trueSize
parameter is aSize
and not adouble
. -
Builds an
Icon
-akin widget set inside aSizedBox
constrained bytrueSize
, with givenicon
data. -
Optionally pass
color
orshadows
.-
✨ As a bonus, each IconToo supports the
shadows
parameter fromTextStyle
, passed asList<Shadow>
and rendered under anIconToo
. -
This is a neat little additional feature, as traditionally an icon shadow might be achieved with something like this.
-
See
Shadow
for more information.
-
-
Replete with proper
Semantics
and debugProperty
s.
❓ Example usage with an 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 Example app #
See some example usage of the Icon package for Flutter included here.
- Icon Example Android source:
/example/lib/main.dart
- Icon Example APK