String? videoPath;
File? _image;
String? previewCover;
String? previewCoverUrl;
List<AssetEntity> result = [];
List<TopicTagModel> data = [];
Future<AssetEntity?> toImageEditor(File origin) async {
return Navigator.push(Get.context!, MaterialPageRoute(builder: (context) {
return ImageEditor(
originImage: origin,
//可空,支持自定义存储位置(编辑后的图片)
);
})).then((res) async {
if (res is EditorImageResult) {
_image = res.newFile;
final File file = _image!; // 你的File对象
final Uint8List byteData = await file.readAsBytes(); // 转为Uint8List
final AssetEntity? imageEntity =
await PhotoManager.editor.saveImage(byteData, title: '');
return imageEntity;
}
}).catchError((er) {
debugPrint(er);
});
}
void pickerImage(context) async {
DialogUtil.showBottomSheetDialog(context,
data: