Avoid using deprecated methods

This commit is contained in:
Vishesh Handa
2020-06-01 20:07:28 +02:00
parent 626f41d426
commit e813edf397

View File

@ -163,12 +163,12 @@ Widget _buildAddBottomSheet(
title: Text(tr('editors.common.takePhoto')), title: Text(tr('editors.common.takePhoto')),
onTap: () async { onTap: () async {
try { try {
var image = await ImagePicker.pickImage( var image = await ImagePicker().getImage(
source: ImageSource.camera, source: ImageSource.camera,
); );
if (image != null) { if (image != null) {
await editorState.addImage(image); await editorState.addImage(File(image.path));
} }
} catch (e) { } catch (e) {
reportError(e, StackTrace.current); reportError(e, StackTrace.current);
@ -181,12 +181,12 @@ Widget _buildAddBottomSheet(
title: Text(tr('editors.common.addImage')), title: Text(tr('editors.common.addImage')),
onTap: () async { onTap: () async {
try { try {
var image = await ImagePicker.pickImage( var image = await ImagePicker().getImage(
source: ImageSource.gallery, source: ImageSource.gallery,
); );
if (image != null) { if (image != null) {
await editorState.addImage(image); await editorState.addImage(File(image.path));
} }
} catch (e) { } catch (e) {
if (e is PlatformException && e.code == "photo_access_denied") { if (e is PlatformException && e.code == "photo_access_denied") {