cropImages method
Implementation
Future<List<List<int>>?> cropImages(
BuildContext context, {
required List<List<int>> imageList,
double? ratio = 1 / 1,
bool isCircle = false,
bool isFree = true,
Color backColor = Colors.white,
}) async {
List<Uint8List> imageDataList = [];
for (var el in imageList) {
final mainImage = imagedit.decodeImage(Uint8List.fromList(el));
final background = imagedit.Image(width: mainImage!.width + 500, height: mainImage.height + 500);
for (var pixel in background) {
pixel.setRgba(backColor.r, backColor.g, backColor.b, backColor.a);
}
imagedit.Image mergeImage = imagedit.compositeImage(background, mainImage, center: true);
//imageDataList.add(Uint8List.fromList(el));
imageDataList.add(imagedit.encodePng(mergeImage));
}
Future<List<Uint8List>?> imdd =
Navigator.push(
context,
CupertinoPageRoute(
builder: ((context) => NsgCropPage(imageDataList: imageDataList, aspectRatio: ratio, isFree: isFree, isCircle: isCircle)),
),
).then((value) {
return value;
});
return await imdd;
}