import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class CropperDialog extends StatefulWidget { var cropper; var initCropper; var crop; var rotate; var scale; CropperDialog( {this.cropper, this.initCropper, this.crop, this.rotate, this.scale}); @override _CropperDialogState createState() => _CropperDialogState(); } class _CropperDialogState extends State { @override void initState() { super.initState(); /// IMPORTANT: must to call this function widget.initCropper(); } @override Widget build(BuildContext context) { return Dialog( child: SizedBox( width: 500, height: 500, child: Column(children: [ SizedBox(width: 400, height: 400, child: widget.cropper), TextButton( onPressed: () async { /// IMPORTANT: to call crop() function and return /// result data to plugin, for example: final result = await widget.crop(); Navigator.of(context).pop(result); }, child: Text('Crop'), ) ]), ), ); } }