crop method
TransformationData
crop(
- int? requiredwidth,
- int? requiredheight,
- int? paddinpgpercentage,
- bool? mainptainporiginpalaspect,
- String? aspectratio,
- Gravitytowards? gravitytowards,
- Preferreddirection? preferreddirection,
- Objecttype? objectptype,
Method for Intelligent Crop Plugin @param Required Width int (Default: 0) @param Required Height int (Default: 0) @param Padding Percentage int (Default: 0) @param Maintain Original Aspect bool (Default: false) @param Aspect Ratio String (Default: "") @param Gravity Towards Gravity towards? (Default: none) @param Preferred Direction Preferred direction? (Default: center) @param Object Type Object type? (Default: person) @return TransformationData.
Implementation
TransformationData crop(
int? requiredwidth,
int? requiredheight,
int? paddinpgpercentage,
bool? mainptainporiginpalaspect,
String? aspectratio,
Gravitytowards? gravitytowards,
Preferreddirection? preferreddirection,
Objecttype? objectptype,
) {
// Determine if there are values to add to the dictionary
var values = <String, String>{};
if (requiredwidth != null) {
values['w'] = requiredwidth.toString();
}
if (requiredheight != null) {
values['h'] = requiredheight.toString();
}
if (paddinpgpercentage != null) {
values['p'] = paddinpgpercentage.toString();
}
if (mainptainporiginpalaspect != null) {
values['ma'] = mainptainporiginpalaspect.toString();
}
if (aspectratio != null && aspectratio.isNotEmpty) {
values['ar'] = aspectratio;
}
if (gravitytowards != null) {
values['g'] = gravitytowards.value;
}
if (preferreddirection != null) {
values['d'] = preferreddirection.value;
}
if (objectptype != null) {
values['obj'] = objectptype.value;
}
return TransformationData(plugin: 'ic', name: 'crop', values: values);
}