mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[fix] transparent svgs (#3213)
* fix: transparent emojis * chore: enhance documentation
This commit is contained in:
parent
29431b3038
commit
f994f50ef9
@ -86,6 +86,7 @@ class SidebarUser extends StatelessWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
child: FlowySvg(
|
||||
FlowySvgData('emoji/$iconUrl'),
|
||||
blendMode: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -318,6 +318,7 @@ class _CurrentIcon extends StatelessWidget {
|
||||
child: FlowySvg(
|
||||
FlowySvgData('emoji/$iconUrl'),
|
||||
size: _iconSize,
|
||||
blendMode: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -388,7 +389,11 @@ class IconOption extends StatelessWidget {
|
||||
borderRadius: Corners.s6Border,
|
||||
hoverColor: Theme.of(context).colorScheme.tertiaryContainer,
|
||||
onTap: () => setIcon(iconUrl),
|
||||
child: FlowySvg(emoji, size: _iconSize),
|
||||
child: FlowySvg(
|
||||
emoji,
|
||||
size: _iconSize,
|
||||
blendMode: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -32,14 +32,19 @@ class FlowySvg extends StatelessWidget {
|
||||
/// The size of the svg
|
||||
final Size? size;
|
||||
|
||||
/// The color of the svg
|
||||
/// The color of the svg.
|
||||
///
|
||||
/// This property will not be applied to the underlying svg widget if the
|
||||
/// blend mode is null, but the blend mode defaults to [BlendMode.srcIn]
|
||||
/// if it is not explicitly set to null.
|
||||
final Color? color;
|
||||
|
||||
/// If true a color filter is applied to the SVG, otherwise not applied.
|
||||
/// The blend mode applied to the svg.
|
||||
///
|
||||
/// Defaults to true
|
||||
///
|
||||
final BlendMode blendMode;
|
||||
/// If the blend mode is null then the icon color will not be applied.
|
||||
/// Set both the icon color and blendMode in order to apply color to the
|
||||
/// svg widget.
|
||||
final BlendMode? blendMode;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -48,7 +53,11 @@ class FlowySvg extends StatelessWidget {
|
||||
final child = SvgPicture.asset(
|
||||
_normalized(),
|
||||
colorFilter:
|
||||
iconColor != null ? ColorFilter.mode(iconColor, blendMode)
|
||||
iconColor != null && blendMode != null
|
||||
? ColorFilter.mode(
|
||||
iconColor,
|
||||
blendMode!,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user