|
|
@ -6,8 +6,7 @@ abstract class NeonCachedImage extends StatefulWidget { |
|
|
|
const NeonCachedImage({ |
|
|
|
const NeonCachedImage({ |
|
|
|
required this.getImageFile, |
|
|
|
required this.getImageFile, |
|
|
|
this.isSvgHint = false, |
|
|
|
this.isSvgHint = false, |
|
|
|
this.height, |
|
|
|
this.size, |
|
|
|
this.width, |
|
|
|
|
|
|
|
this.fit, |
|
|
|
this.fit, |
|
|
|
this.svgColor, |
|
|
|
this.svgColor, |
|
|
|
this.iconColor, |
|
|
|
this.iconColor, |
|
|
@ -17,8 +16,7 @@ abstract class NeonCachedImage extends StatefulWidget { |
|
|
|
final Future<File> Function() getImageFile; |
|
|
|
final Future<File> Function() getImageFile; |
|
|
|
final bool isSvgHint; |
|
|
|
final bool isSvgHint; |
|
|
|
|
|
|
|
|
|
|
|
final double? height; |
|
|
|
final Size? size; |
|
|
|
final double? width; |
|
|
|
|
|
|
|
final BoxFit? fit; |
|
|
|
final BoxFit? fit; |
|
|
|
|
|
|
|
|
|
|
|
final Color? svgColor; |
|
|
|
final Color? svgColor; |
|
|
@ -44,8 +42,8 @@ class _NeonCachedImageState extends State<NeonCachedImage> { |
|
|
|
if (widget.isSvgHint || utf8.decode(content).contains('<svg')) { |
|
|
|
if (widget.isSvgHint || utf8.decode(content).contains('<svg')) { |
|
|
|
return SvgPicture.memory( |
|
|
|
return SvgPicture.memory( |
|
|
|
content, |
|
|
|
content, |
|
|
|
height: widget.height, |
|
|
|
height: widget.size?.height, |
|
|
|
width: widget.width, |
|
|
|
width: widget.size?.width, |
|
|
|
fit: widget.fit ?? BoxFit.contain, |
|
|
|
fit: widget.fit ?? BoxFit.contain, |
|
|
|
color: widget.svgColor, |
|
|
|
color: widget.svgColor, |
|
|
|
); |
|
|
|
); |
|
|
@ -56,8 +54,8 @@ class _NeonCachedImageState extends State<NeonCachedImage> { |
|
|
|
|
|
|
|
|
|
|
|
return Image.memory( |
|
|
|
return Image.memory( |
|
|
|
content, |
|
|
|
content, |
|
|
|
height: widget.height, |
|
|
|
height: widget.size?.height, |
|
|
|
width: widget.width, |
|
|
|
width: widget.size?.width, |
|
|
|
fit: widget.fit, |
|
|
|
fit: widget.fit, |
|
|
|
gaplessPlayback: true, |
|
|
|
gaplessPlayback: true, |
|
|
|
); |
|
|
|
); |
|
|
@ -72,14 +70,12 @@ class _NeonCachedImageState extends State<NeonCachedImage> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
onlyIcon: true, |
|
|
|
onlyIcon: true, |
|
|
|
iconSize: widget.height != null && widget.width != null |
|
|
|
iconSize: widget.size?.shortestSide, |
|
|
|
? min(widget.height!, widget.width!) |
|
|
|
|
|
|
|
: widget.height ?? widget.width, |
|
|
|
|
|
|
|
color: widget.iconColor ?? Colors.red, |
|
|
|
color: widget.iconColor ?? Colors.red, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
return SizedBox( |
|
|
|
return SizedBox( |
|
|
|
width: widget.width, |
|
|
|
width: widget.size?.width, |
|
|
|
child: NeonLinearProgressIndicator( |
|
|
|
child: NeonLinearProgressIndicator( |
|
|
|
color: widget.iconColor, |
|
|
|
color: widget.iconColor, |
|
|
|
), |
|
|
|
), |
|
|
|