diff --git a/assets/subtitles/ar_subtitle.json b/assets/subtitles/ar_subtitle.json index e419c327..c39d143d 100644 --- a/assets/subtitles/ar_subtitle.json +++ b/assets/subtitles/ar_subtitle.json @@ -202,5 +202,6 @@ "department": "قسم", "room": "غرفه", "actions": "اجراءات", - "deviceFiles": "ملفات الجهاز" + "deviceFiles": "ملفات الجهاز", + "pickFromFiles" : "اختر من الملفات" } \ No newline at end of file diff --git a/assets/subtitles/en_subtitle.json b/assets/subtitles/en_subtitle.json index 33ff94b5..1decda42 100644 --- a/assets/subtitles/en_subtitle.json +++ b/assets/subtitles/en_subtitle.json @@ -202,5 +202,6 @@ "department": "Department", "room": "Room", "actions": "Actions", - "deviceFiles": "Asset Files" + "deviceFiles": "Asset Files", + "pickFromFiles" : "Pick From Files" } \ No newline at end of file diff --git a/lib/models/subtitle.dart b/lib/models/subtitle.dart index fe71b3c3..1304614a 100644 --- a/lib/models/subtitle.dart +++ b/lib/models/subtitle.dart @@ -237,6 +237,7 @@ class Subtitle { String department; String room; String actions; + String pickFromFiles; void setIssues(List issues) { issues.clear(); @@ -449,6 +450,7 @@ class Subtitle { @required this.department, @required this.room, @required this.actions, + @required this.pickFromFiles, }); factory Subtitle.fromJson(Map parsedJson) { @@ -654,6 +656,7 @@ class Subtitle { department: parsedJson["department"], room: parsedJson["room"], actions: parsedJson["actions"], + pickFromFiles: parsedJson["pickFromFiles"], ); } } diff --git a/lib/views/widgets/images/multi_image_picker.dart b/lib/views/widgets/images/multi_image_picker.dart index 7d6d6445..84ad643e 100644 --- a/lib/views/widgets/images/multi_image_picker.dart +++ b/lib/views/widgets/images/multi_image_picker.dart @@ -143,7 +143,7 @@ class _MultiFilesPickerState extends State with TickerProvider ); } - onFilePicker(Subtitle subtitle) async { + fromFilePicker(Subtitle subtitle) async { FilePickerResult result = await FilePicker.platform.pickFiles( type: FileType.custom, allowMultiple: true, @@ -157,29 +157,37 @@ class _MultiFilesPickerState extends State with TickerProvider } } - onImagePick(Subtitle subtitle) async { + onFilePicker(Subtitle subtitle) async { if (widget.files.length >= 5) { Fluttertoast.showToast(msg: subtitle.maxImagesNumberIs5); return; } ImageSource source = await showDialog( - context: context, - builder: (dialogContext) => CupertinoAlertDialog( - actions: [ - TextButton( - child: Text(subtitle.pickFromCamera), - onPressed: () { - Navigator.of(dialogContext).pop(ImageSource.camera); - }, - ), - TextButton( - child: Text(subtitle.pickFromGallery), - onPressed: () { - Navigator.of(dialogContext).pop(ImageSource.gallery); - }, - ), - ], - )); + context: context, + builder: (dialogContext) => CupertinoAlertDialog( + actions: [ + TextButton( + child: Text(subtitle.pickFromCamera), + onPressed: () { + Navigator.of(dialogContext).pop(ImageSource.camera); + }, + ), + TextButton( + child: Text(subtitle.pickFromGallery), + onPressed: () { + Navigator.of(dialogContext).pop(ImageSource.gallery); + }, + ), + TextButton( + child: Text(subtitle.pickFromFiles), + onPressed: () async { + await fromFilePicker(subtitle); + Navigator.pop(context); + }, + ), + ], + ), + ); if (source == null) return; final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);