ImageX
Just a lazy image widget that accepts any path of Asset, Path, Url to load all image types including SVG.
Takes these named paramters:
String pathrequired path to image. It could beAsset, Path, or Urldouble? heightoptional widget height.double? widthoptional widget width.double scaleoptional image scale to the size with default value = 1.BorderRadius borderRadiusoptional borderRadius with default value = BorderRadius.zeroBoxDecoration? decorationoptional decoration.BoxFit? fitoptional fit with default value = BoxFit.containWidget? loadingWidgetoptional loading widget.Widget? errorWidgetfallback error widget with default value of x iconColor? svgColorin case ofSVGyou can optionally set colorVoidCallback? onPressedoptional onPressed callback function.
Example:
class MyLogo extends StatelessWidget {
const MyLogo({super.key});
@override
Widget build(BuildContext context) {
return const ImageX(
path: 'assets/images/logo.svg',
height: 200,
width: 200,
scale: .66,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(width: 2, color: Colors.blue),
),
svgColor: Colors.blue,
);
}
}