imageWidget method
Implementation
Widget imageWidget(String? id,
{required WidgetSize size, required BoxFit fit}) {
if (id?.isNotEmpty != true) return const SizedBox();
return FutureBuilder<Uint8List?>(
key: Key(id!),
future: DI.media().getImage(id),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Image.memory(
key: Key(id),
snapshot.data!,
width: size.width,
height: size.height,
fit: fit,
gaplessPlayback: true,
errorBuilder: (context, obj, stack) {
return SizedBox(
width: size.width,
height: size.height,
child: SvgPicture.memory(
key: Key(id),
snapshot.data!,
width: size.width,
height: size.height,
fit: fit,
),
);
},
);
}
return SizedBox(
width: size.width,
height: size.height
);
});
}