Merge branch 'zaid_development_new' into sikander-development

design_3.0_internal_audit_module
Sikander Saleem 3 years ago
commit ef2431d7df

@ -202,5 +202,6 @@
"department": "قسم", "department": "قسم",
"room": "غرفه", "room": "غرفه",
"actions": "اجراءات", "actions": "اجراءات",
"deviceFiles": "ملفات الجهاز" "deviceFiles": "ملفات الجهاز",
"pickFromFiles" : "اختر من الملفات"
} }

@ -202,5 +202,6 @@
"department": "Department", "department": "Department",
"room": "Room", "room": "Room",
"actions": "Actions", "actions": "Actions",
"deviceFiles": "Asset Files" "deviceFiles": "Asset Files",
"pickFromFiles" : "Pick From Files"
} }

@ -237,6 +237,7 @@ class Subtitle {
String department; String department;
String room; String room;
String actions; String actions;
String pickFromFiles;
void setIssues(List<String> issues) { void setIssues(List<String> issues) {
issues.clear(); issues.clear();
@ -449,6 +450,7 @@ class Subtitle {
@required this.department, @required this.department,
@required this.room, @required this.room,
@required this.actions, @required this.actions,
@required this.pickFromFiles,
}); });
factory Subtitle.fromJson(Map<String, dynamic> parsedJson) { factory Subtitle.fromJson(Map<String, dynamic> parsedJson) {
@ -654,6 +656,7 @@ class Subtitle {
department: parsedJson["department"], department: parsedJson["department"],
room: parsedJson["room"], room: parsedJson["room"],
actions: parsedJson["actions"], actions: parsedJson["actions"],
pickFromFiles: parsedJson["pickFromFiles"],
); );
} }
} }

@ -143,7 +143,7 @@ class _MultiFilesPickerState extends State<MultiFilesPicker> with TickerProvider
); );
} }
onFilePicker(Subtitle subtitle) async { fromFilePicker(Subtitle subtitle) async {
FilePickerResult result = await FilePicker.platform.pickFiles( FilePickerResult result = await FilePicker.platform.pickFiles(
type: FileType.custom, type: FileType.custom,
allowMultiple: true, allowMultiple: true,
@ -157,29 +157,37 @@ class _MultiFilesPickerState extends State<MultiFilesPicker> with TickerProvider
} }
} }
onImagePick(Subtitle subtitle) async { onFilePicker(Subtitle subtitle) async {
if (widget.files.length >= 5) { if (widget.files.length >= 5) {
Fluttertoast.showToast(msg: subtitle.maxImagesNumberIs5); Fluttertoast.showToast(msg: subtitle.maxImagesNumberIs5);
return; return;
} }
ImageSource source = await showDialog( ImageSource source = await showDialog(
context: context, context: context,
builder: (dialogContext) => CupertinoAlertDialog( builder: (dialogContext) => CupertinoAlertDialog(
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text(subtitle.pickFromCamera), child: Text(subtitle.pickFromCamera),
onPressed: () { onPressed: () {
Navigator.of(dialogContext).pop(ImageSource.camera); Navigator.of(dialogContext).pop(ImageSource.camera);
}, },
), ),
TextButton( TextButton(
child: Text(subtitle.pickFromGallery), child: Text(subtitle.pickFromGallery),
onPressed: () { onPressed: () {
Navigator.of(dialogContext).pop(ImageSource.gallery); Navigator.of(dialogContext).pop(ImageSource.gallery);
}, },
), ),
], TextButton(
)); child: Text(subtitle.pickFromFiles),
onPressed: () async {
await fromFilePicker(subtitle);
Navigator.pop(context);
},
),
],
),
);
if (source == null) return; if (source == null) return;
final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800); final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);

Loading…
Cancel
Save