toEditor method

Future<void> toEditor(
  1. BuildContext context,
  2. EditorType type
)

Implementation

Future<void> toEditor(BuildContext context, EditorType type) async {
  saved = false;
  if (type == EditorType.crop) {
    EditorUtil.goCropPage(context, this.state.afterPath);
  } else if (type == EditorType.colors) {
    EditorUtil.goColorsPage(context, this.state.afterPath);
  } else if (type == EditorType.filter) {
    if (EditorUtil.filterList.isEmpty) {
      await EditorUtil.fetchFilterList(context);
    }
    EditorUtil.goFilterPage(context, this.state.afterPath);
  } else if (type == EditorType.blur) {
    EditorUtil.showToast('功能开发中...');
    // ... todo
  } else if (type == EditorType.sticker) {
    if (EditorUtil.stickerList.isEmpty) {
      await EditorUtil.fetchStickerList(context);
    }
    EditorUtil.goStickerPage(context, this.state.afterPath);
  } else if (type == EditorType.text) {
    if (EditorUtil.fontList.isEmpty) {
      await EditorUtil.fetchFontList(context);
    }
    EditorUtil.goFontPage(context, this.state.afterPath);
  } else if (type == EditorType.frame) {
    if (EditorUtil.frameList.isEmpty) {
      await EditorUtil.fetchFrameList(context);
    }
    EditorUtil.goFramePage(context, this.state.afterPath);
  }
}