openAspectRatioOptions method

void openAspectRatioOptions()

Opens a dialog to select from predefined aspect ratios.

Implementation

void openAspectRatioOptions() {
  showModalBottomSheet<double>(
      context: context,
      backgroundColor:
          imageEditorTheme.cropRotateEditor.aspectRatioSheetBackgroundColor,
      isScrollControlled: true,
      builder: (BuildContext context) {
        return customWidgets.cropRotateEditor.aspectRatioOptions?.call(
              this,
              rebuildController.stream,
              aspectRatio,
              _mainImageSize.aspectRatio,
            ) ??
            CropAspectRatioOptions(
              aspectRatio: aspectRatio,
              configs: configs,
              originalAspectRatio: _mainImageSize.aspectRatio,
            );
      }).then((value) {
    if (value != null) {
      reset(skipAddHistory: true);
      aspectRatio = value;
      cropRotateEditorCallbacks?.handleRatioSelected(value);

      calcCropRect();
      calcFitToScreen();
      addHistory(scaleRotation: oldScaleFactor, angle: 0);
      _updateAllStates();
    }
  });
}