clip static method
Widget
clip({
- String? url,
- String? cacheKey,
- String? cacheTag,
- Widget? placeholder,
- ValueChanged<
ImageInfo?> ? imageCompletionHandler, - Widget? errorWidget,
- double? width,
- double? height,
- BoxFit? fit,
- int retries = 3,
- Duration? timeLimit,
- Map<
String, String> ? headers, - double? borderRadius,
- Color? placeholderColor,
- bool round = false,
Implementation
static Widget clip({
String? url,
String? cacheKey,
String? cacheTag,
Widget? placeholder,
ValueChanged<ImageInfo?>? imageCompletionHandler,
Widget? errorWidget,
double? width,
double? height,
BoxFit? fit,
int retries = 3,
Duration? timeLimit,
Map<String, String>? headers,
double? borderRadius,
Color? placeholderColor,
bool round = false,
}) {
Widget image() {
Widget colorWidget() {
return placeholder ??
Container(
width: width,
height: height,
color: placeholderColor ?? baseWebImageDefaultPlaceholderColor,
);
}
return Container(
width: width,
height: height,
color: placeholder == null
? (placeholderColor ?? baseWebImageDefaultPlaceholderColor)
: null,
child: BaseWebImage(
url,
cacheKey: cacheKey,
cacheTag: cacheTag,
fit: fit,
retries: retries,
timeLimit: timeLimit,
headers: headers,
placeholder: placeholder ?? colorWidget(),
errorWidget: errorWidget ?? colorWidget(),
imageCompletionHandler: imageCompletionHandler,
),
);
}
if (round || borderRadius != null) {
return ClipRRect(
borderRadius: BorderRadius.circular(
(round && width != null) ? width * 0.5 : (borderRadius ?? 0),
),
child: image(),
);
}
return image();
}