fromMemory static method
Widget
fromMemory(
- Uint8List bytes, {
- double? width,
- double? height,
- Color? color,
- BoxDecoration? decoration,
- EdgeInsets? padding,
- EdgeInsets? margin,
- bool isCircle = false,
- BoxFit fit = BoxFit.contain,
- bool backOffSizing = true,
- bool enableMirror = false,
Create an image from memory with bytes
backOffSizing
determine whether to use backOff dimension if not set
eg. if width is not set, use height instead
enableMirror
will make your image mirrored!
Implementation
static Widget fromMemory(
Uint8List bytes, {
double? width,
double? height,
Color? color,
BoxDecoration? decoration,
EdgeInsets? padding,
EdgeInsets? margin,
bool isCircle = false,
BoxFit fit = BoxFit.contain,
bool backOffSizing = true,
bool enableMirror = false,
}) {
double? measuredHeight = height ?? (backOffSizing ? width : null);
double? measuredWidth = width ?? (backOffSizing ? height : null);
Widget image = Image.memory(
bytes,
width: measuredWidth,
height: measuredHeight,
color: color,
fit: fit,
);
return Container(
padding: padding,
margin: margin,
clipBehavior: Clip.antiAlias,
decoration: isCircle == true ? _circle : decoration,
child: image,
).makeMirror(enableMirror);
}