Add decoration capabilities to the Icon
widget with borders and gradients. This new DecoratedIcon
widget overlap itself with the base Icon
widget to provide a more complete decoration system through a IconDecoration
property.
icon_decoration: any
import 'package:icon_decoration/icon_decoration.dart';
DecoratedIcon(
icon: Icon(Icons.favorite, color: Colors.green),
decoration: IconDecoration(border: IconBorder()),
)
Gradients are supported on Flutter Web only with the canvaskit renderer
DecoratedIcon(
icon: Icon(Icons.all_inbox),
decoration: IconDecoration(
gradient: rainbowGradient,
),
)
DecoratedIcon(
icon: Icon(
Icons.all_inbox,
shadows: [
Shadow(
color: Colors.red,
blurRadius: 3,
offset: Offset(0, 2),
),
],
),
decoration: IconDecoration(
gradient: _rainbowGradient,
border: IconBorder(),
),
)
- Removed
IconDecoration.shadows
, useIcon.shadows
instead.
Before
DecoratedIcon(
icon: Icon(Icons.all_inbox),
decoration: IconDecoration(
shadows: [
Shadow(
color: Colors.red,
blurRadius: 3,
offset: Offset(0, 2),
),
],
),
)
After
Icon(
Icons.all_inbox,
shadows: [
Shadow(
color: Colors.red,
blurRadius: 3,
offset: Offset(0, 2),
),
],
),