GET_IMAGE_FILE function
Widget
GET_IMAGE_FILE(
- File imageFile,
- dynamic customHeight,
- dynamic customWidth,
- dynamic iconDefault,
- dynamic customRadius, {
- Color? iconColor,
})
Implementation
Widget GET_IMAGE_FILE(File imageFile, customHeight, customWidth, iconDefault, customRadius, {Color? iconColor}) {
double width = (customWidth ?? 50) + .0; // + .0 for to convert int to double
double height = (customHeight ?? 50) + .0;
return StatefulBuilder( builder: (BuildContext context, StateSetter setStateModal ) {
ColorScheme colorScheme = Theme.of(context).colorScheme;
Icon icon = Icon(iconDefault, size: width+12, color: (iconColor ?? colorScheme.onBackground).withOpacity(.6) );
return ClipRRect(
borderRadius: BorderRadius.circular(customRadius+.0),
child: imageFile.toString() == ''
? icon
: Image.file(
imageFile, width: width, height: height,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
developer.log('page_manager -> getImageFile() error');
developer.log(exception.toString());
return icon;
}
)
);
});
}