getAssets static method
Widget
getAssets(
- String assetName, {
- Key? key,
- double? width,
- double? height,
- bool? isCustom = false,
- PathFormat pathFormat = PathFormat.icons,
- ImageFormat format = ImageFormat.png,
- BoxFit fit = BoxFit.contain,
- Color? color,
- void click()?,
Implementation
static Widget getAssets(
String assetName, {
Key? key,
double? width,
double? height,
bool? isCustom = false,
PathFormat pathFormat = PathFormat.icons,
ImageFormat format = ImageFormat.png,
BoxFit fit = BoxFit.contain,
Color? color,
void Function()? click,
}) {
return GestureDetector(
onTap: click != null
? () {
click.call();
}
: null,
child: format == ImageFormat.svg
? SvgPicture.asset(
key: key,
isCustom!
? assetName
: 'assets/${pathFormat.name}/$assetName.${format.name}',
width: width,
height: height,
colorFilter: color != null
? ColorFilter.mode(
color,
BlendMode.srcIn,
)
: null,
fit: fit,
)
: Image.asset(
isCustom!
? assetName
: 'assets/${pathFormat.name}/$assetName.${format.name}',
key: key,
width: width,
height: height,
fit: fit,
color: color,
),
);
}