[feat] improve svg widget api (#3205)

* feat: change api

* fix: api upgrade errors
This commit is contained in:
Alex Wallen 2023-08-14 16:26:11 -07:00 committed by GitHub
parent 243f80b6d5
commit 00ee4be723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -86,7 +86,6 @@ class SidebarUser extends StatelessWidget {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: FlowySvg( child: FlowySvg(
FlowySvgData('emoji/$iconUrl'), FlowySvgData('emoji/$iconUrl'),
overrideColor: false,
), ),
), ),
), ),

View File

@ -318,7 +318,6 @@ class _CurrentIcon extends StatelessWidget {
child: FlowySvg( child: FlowySvg(
FlowySvgData('emoji/$iconUrl'), FlowySvgData('emoji/$iconUrl'),
size: _iconSize, size: _iconSize,
overrideColor: false,
), ),
), ),
), ),
@ -389,7 +388,7 @@ class IconOption extends StatelessWidget {
borderRadius: Corners.s6Border, borderRadius: Corners.s6Border,
hoverColor: Theme.of(context).colorScheme.tertiaryContainer, hoverColor: Theme.of(context).colorScheme.tertiaryContainer,
onTap: () => setIcon(iconUrl), onTap: () => setIcon(iconUrl),
child: FlowySvg(emoji, size: _iconSize, overrideColor: false), child: FlowySvg(emoji, size: _iconSize),
); );
} }
} }

View File

@ -22,7 +22,7 @@ class FlowySvg extends StatelessWidget {
super.key, super.key,
this.size, this.size,
this.color, this.color,
this.overrideColor = true, this.blendMode = BlendMode.srcIn,
}); });
/// The data for the flowy svg. Will be generated by the generator in this /// The data for the flowy svg. Will be generated by the generator in this
@ -39,7 +39,7 @@ class FlowySvg extends StatelessWidget {
/// ///
/// Defaults to true /// Defaults to true
/// ///
final bool overrideColor; final BlendMode blendMode;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -47,8 +47,8 @@ class FlowySvg extends StatelessWidget {
final child = SvgPicture.asset( final child = SvgPicture.asset(
_normalized(), _normalized(),
colorFilter: iconColor != null && overrideColor colorFilter:
? ColorFilter.mode(iconColor, BlendMode.srcIn) iconColor != null ? ColorFilter.mode(iconColor, blendMode)
: null, : null,
); );