showCropUI static method
Show the interactive crop UI and return the selected crop rectangle
Implementation
static Future<CropRect?> showCropUI(
BuildContext context,
String imagePath,
CropOptions? cropOptions,
) async {
if (!context.mounted) return null;
CropRect? selectedCropRect;
final result = await Navigator.of(context).push<CropRect>(
MaterialPageRoute(
builder: (context) => CropUI(
imagePath: imagePath,
initialCropOptions: cropOptions,
onCropChanged: (cropRect) {
selectedCropRect = cropRect;
},
onConfirm: () {
Navigator.of(context).pop(selectedCropRect);
},
onCancel: () {
Navigator.of(context).pop(null);
},
),
fullscreenDialog: true,
),
);
return result;
}