crop method
TransformationData
crop(
- int? requiredWidth,
- int? requiredHeight,
- int? paddingPercentage,
- bool? maintainOriginalAspect,
- String? aspectRatio,
- IcGravitytowards? gravityTowards,
- IcPreferreddirection? preferredDirection,
- IcObjectType? objectType,
Method for Intelligent Crop Plugin
requiredWidth
: Required Width (Default: 0)requiredHeight
: Required Height (Default: 0)paddingPercentage
: Padding Percentage (Default: 0)maintainOriginalAspect
: Maintain Original Aspect (Default: false)aspectRatio
: Aspect Ratio (Default: "")gravityTowards
: IcGravitytowards (Default: none)preferredDirection
: IcPreferreddirection (Default: center)objectType
: IcObjectType (Default: person) Returns TransformationData.
Implementation
TransformationData crop(
int? requiredWidth,
int? requiredHeight,
int? paddingPercentage,
bool? maintainOriginalAspect,
String? aspectRatio,
IcGravitytowards? gravityTowards,
IcPreferreddirection? preferredDirection,
IcObjectType? objectType,
) {
var values = <String, String>{};
if (requiredWidth != null) {
values['w'] = requiredWidth.toString();
}
if (requiredHeight != null) {
values['h'] = requiredHeight.toString();
}
if (paddingPercentage != null) {
values['p'] = paddingPercentage.toString();
}
if (maintainOriginalAspect != null) {
values['ma'] = maintainOriginalAspect.toString();
}
if (aspectRatio != null && aspectRatio.isNotEmpty) {
values['ar'] = aspectRatio;
}
if (gravityTowards != null) {
values['g'] = gravityTowards.value;
}
if (preferredDirection != null) {
values['d'] = preferredDirection.value;
}
if (objectType != null) {
values['obj'] = objectType.value;
}
return TransformationData(plugin: 'ic', name: 'crop', values: values);
}