getImageWidget function
Implementation
Widget getImageWidget(String filePath, [bool isAlert = false]) {
if (filePath.startsWith('http')) {
return Image.network(
filePath,
scale: 4,
);
}
else if (filePath.endsWith('.mp4') || filePath.endsWith('.avi')) {
if(isAlert){
return VideoPlayerWidget(videoPath: filePath);
}else{
return FutureBuilder<t.Uint8List?>(
future: _getFirstFrameThumbnail(filePath),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) {
return Image.memory(
snapshot.data!,
fit: BoxFit.cover,
);
} else {
return const Icon(
Icons.videocam,
size: 50,
color: Colors.black,
);
}
},
);
}
}
else {
return Image.file(
File(filePath),
scale: 4,
);
}
}