|
|
|
|
@ -195,7 +195,7 @@ class _MultiFilesPickerState extends State<MultiFilesPicker> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
icon.toSvgAsset(),
|
|
|
|
|
label.bodyText2(context).custom(color: AppColor.black20),
|
|
|
|
|
Text(label, style: AppTextStyles.bodyText2).custom(color: AppColor.black20),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -223,99 +223,9 @@ class _MultiFilesPickerState extends State<MultiFilesPicker> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
title: "Attach File");
|
|
|
|
|
//
|
|
|
|
|
// showModalBottomSheet<ImageSource>(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
|
// return;
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// ImageSource? source = await showModalBottomSheet<ImageSource>(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
|
// Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
|
|
|
|
|
// return GestureDetector(
|
|
|
|
|
// onTap: onTap,
|
|
|
|
|
// child: Container(
|
|
|
|
|
// constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight),
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight),
|
|
|
|
|
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)),
|
|
|
|
|
// child: Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// icon.toSvgAsset(),
|
|
|
|
|
// 24.height,
|
|
|
|
|
// label.bodyText2(context).custom(color: AppColor.black20),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return Container(
|
|
|
|
|
// padding: const EdgeInsets.all(16.0),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
// listCard(
|
|
|
|
|
// icon: 'camera_icon',
|
|
|
|
|
// label: '${context.translation.open}\n${context.translation.camera}',
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// Navigator.of(context).pop(ImageSource.camera);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// listCard(
|
|
|
|
|
// icon: 'gallery_icon',
|
|
|
|
|
// label: '${context.translation.open}\n${context.translation.gallery}',
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// Navigator.of(context).pop(ImageSource.gallery);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// listCard(
|
|
|
|
|
// icon: 'file_icon',
|
|
|
|
|
// label: '${context.translation.open}\n${context.translation.files}',
|
|
|
|
|
// onTap: () async {
|
|
|
|
|
// await fromFilePicker();
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
// ImageSource source = await showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (dialogContext) => CupertinoAlertDialog(
|
|
|
|
|
// actions: <Widget>[
|
|
|
|
|
// TextButton(
|
|
|
|
|
// child: Text(context.translation.pickFromCamera),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// Navigator.of(dialogContext).pop(ImageSource.camera);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// TextButton(
|
|
|
|
|
// child: Text(context.translation.pickFromGallery),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// Navigator.of(dialogContext).pop(ImageSource.gallery);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// TextButton(
|
|
|
|
|
// child: Text(context.translation.pickFromFiles),
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// await fromFilePicker();
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
if (source == null) return;
|
|
|
|
|
|
|
|
|
|
final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);
|
|
|
|
|
|
|
|
|
|
if (pickedFile != null) {
|
|
|
|
|
File fileImage = File(pickedFile.path);
|
|
|
|
|
widget.files.add(fileImage);
|
|
|
|
|
@ -334,17 +244,11 @@ class AttachmentModel {
|
|
|
|
|
AttachmentModel(this.id, this.file);
|
|
|
|
|
|
|
|
|
|
factory AttachmentModel.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
return AttachmentModel(
|
|
|
|
|
json['id'] ?? 0,
|
|
|
|
|
json['file'] != null ? File(json['file']) : null,
|
|
|
|
|
);
|
|
|
|
|
return AttachmentModel(json['id'] ?? 0, json['file'] != null ? File(json['file']) : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
return {
|
|
|
|
|
'id': id,
|
|
|
|
|
'file': file?.path,
|
|
|
|
|
};
|
|
|
|
|
return {'id': id, 'file': file?.path};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|