mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
Avoid using deprecated methods
This commit is contained in:
@ -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") {
|
||||||
|
Reference in New Issue
Block a user