2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ import 'package:flutter/foundation.dart' ;
5
6
import 'package:flutter/rendering.dart' ;
6
7
import 'package:flutter/widgets.dart' ;
7
8
@@ -26,6 +27,7 @@ class FaIcon extends StatelessWidget {
26
27
this .color,
27
28
this .semanticLabel,
28
29
this .textDirection,
30
+ this .shadows,
29
31
}) : super (key: key);
30
32
31
33
/// The icon to display. Available icons are listed in [FontAwesomeIcons] .
@@ -102,6 +104,17 @@ class FaIcon extends StatelessWidget {
102
104
/// specified, either directly using this property or using [Directionality] .
103
105
final TextDirection ? textDirection;
104
106
107
+ /// A list of [Shadow] s that will be painted underneath the icon.
108
+ ///
109
+ /// Multiple shadows are supported to replicate lighting from multiple light
110
+ /// sources.
111
+ ///
112
+ /// Shadows must be in the same order for [Icon] to be considered as
113
+ /// equivalent as order produces differing transparency.
114
+ ///
115
+ /// Defaults to the nearest [IconTheme] 's [IconThemeData.shadows] .
116
+ final List <Shadow >? shadows;
117
+
105
118
@override
106
119
Widget build (BuildContext context) {
107
120
assert (this .textDirection != null || debugCheckHasDirectionality (context));
@@ -111,6 +124,7 @@ class FaIcon extends StatelessWidget {
111
124
final IconThemeData iconTheme = IconTheme .of (context);
112
125
113
126
final double ? iconSize = size ?? iconTheme.size;
127
+ final List <Shadow >? iconShadows = shadows ?? iconTheme.shadows;
114
128
115
129
if (icon == null ) {
116
130
return Semantics (
@@ -138,6 +152,7 @@ class FaIcon extends StatelessWidget {
138
152
fontSize: iconSize,
139
153
fontFamily: icon! .fontFamily,
140
154
package: icon! .fontPackage,
155
+ shadows: iconShadows,
141
156
),
142
157
),
143
158
);
@@ -172,5 +187,7 @@ class FaIcon extends StatelessWidget {
172
187
IconDataProperty ('icon' , icon, ifNull: '<empty>' , showName: false ));
173
188
properties.add (DoubleProperty ('size' , size, defaultValue: null ));
174
189
properties.add (ColorProperty ('color' , color, defaultValue: null ));
190
+ properties
191
+ .add (IterableProperty <Shadow >('shadows' , shadows, defaultValue: null ));
175
192
}
176
193
}
0 commit comments