dummyImage static method
Generates a random image URL from dummyimage with the specified dimensions .
The width
and height
parameters specify the dimensions of the image.
Returns a string representing the URL of the random image.
Implementation
static String dummyImage({
String? text,
Size size = const Size(300, 300),
ImageType imageType = ImageType.png,
Color bgColor = Colors.grey,
Color fgColor = Colors.black,
}) {
final imageSize = '${size.width.toInt()}x${size.height.toInt()}';
final imageText = text ?? imageSize;
final data =
'https://dummyimage.com/$imageSize.${imageType.name}/${bgColor.toHex(
leadingHashSign: false,
)}/${fgColor.toHex(leadingHashSign: false)}&text=$imageText';
// debugPrint(data);
return data;
}