mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-11-04 03:54:44 +00:00 
			
		
		
		
	fix: semi-transparent colors being forced to full opacity in FlowySvg (#6376)
* fix: semi-transparent colors being forced to full opacity * chore: code style * chore: update comment
This commit is contained in:
		
							parent
							
								
									99889b9950
								
							
						
					
					
						commit
						eeb6b69f58
					
				@ -23,7 +23,7 @@ class FlowySvg extends StatelessWidget {
 | 
				
			|||||||
    this.size,
 | 
					    this.size,
 | 
				
			||||||
    this.color,
 | 
					    this.color,
 | 
				
			||||||
    this.blendMode = BlendMode.srcIn,
 | 
					    this.blendMode = BlendMode.srcIn,
 | 
				
			||||||
    this.opacity = 1.0,
 | 
					    this.opacity,
 | 
				
			||||||
    this.svgString,
 | 
					    this.svgString,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -34,7 +34,7 @@ class FlowySvg extends StatelessWidget {
 | 
				
			|||||||
    Size? size,
 | 
					    Size? size,
 | 
				
			||||||
    Color? color,
 | 
					    Color? color,
 | 
				
			||||||
    BlendMode? blendMode = BlendMode.srcIn,
 | 
					    BlendMode? blendMode = BlendMode.srcIn,
 | 
				
			||||||
    double opacity = 1.0,
 | 
					    double? opacity,
 | 
				
			||||||
  }) {
 | 
					  }) {
 | 
				
			||||||
    return FlowySvg(
 | 
					    return FlowySvg(
 | 
				
			||||||
      const FlowySvgData(''),
 | 
					      const FlowySvgData(''),
 | 
				
			||||||
@ -73,13 +73,16 @@ class FlowySvg extends StatelessWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /// The opacity of the svg
 | 
					  /// The opacity of the svg
 | 
				
			||||||
  ///
 | 
					  ///
 | 
				
			||||||
  /// The default value is 1.0
 | 
					  /// if null then use the opacity of the iconColor
 | 
				
			||||||
  final double opacity;
 | 
					  final double? opacity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    final iconColor =
 | 
					    Color? iconColor = color ?? Theme.of(context).iconTheme.color;
 | 
				
			||||||
        (color ?? Theme.of(context).iconTheme.color)?.withOpacity(opacity);
 | 
					    if (opacity != null) {
 | 
				
			||||||
 | 
					      iconColor = iconColor?.withOpacity(opacity!);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final textScaleFactor = MediaQuery.textScalerOf(context).scale(1);
 | 
					    final textScaleFactor = MediaQuery.textScalerOf(context).scale(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final Widget svg;
 | 
					    final Widget svg;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user