previewProductImage function
Returns a preview of a product image from base64-encoded string.
Parameters:
fileUser: Base64-encoded image string.context: Build context.
Implementation
Widget previewProductImage(String fileUser, BuildContext context) {
final bytes = base64Decode(fileUser);
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
shape: BoxShape.rectangle,
color: Colors.amber),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.memory(
bytes,
height: getHeight(20, context),
width: getWidth(30, context),
fit: BoxFit.cover,
),
),
);
}