From 3181e666be981624ac45dadaf27e0f9ca38166df Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 9 Jul 2025 11:01:41 +0300 Subject: [PATCH] improvements --- lib/extensions/context_extension.dart | 2 +- .../widgets/images/multi_image_picker.dart | 102 +----------------- 2 files changed, 4 insertions(+), 100 deletions(-) diff --git a/lib/extensions/context_extension.dart b/lib/extensions/context_extension.dart index 70c934b9..b8ef0520 100644 --- a/lib/extensions/context_extension.dart +++ b/lib/extensions/context_extension.dart @@ -12,7 +12,7 @@ extension BuildContextExtension on BuildContext { List get getIssues => [translation.reason1, translation.reason2, translation.reason3, translation.reason4, translation.reason5]; - bool get isDark => Provider.of(this, listen: false).theme == "dark"; + bool get isDark => Provider.of(this).theme == "dark"; bool get isAr => Provider.of(this).language == "ar"; diff --git a/lib/views/widgets/images/multi_image_picker.dart b/lib/views/widgets/images/multi_image_picker.dart index 40955bcf..3458f876 100644 --- a/lib/views/widgets/images/multi_image_picker.dart +++ b/lib/views/widgets/images/multi_image_picker.dart @@ -195,7 +195,7 @@ class _MultiFilesPickerState extends State { 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 { ], ), title: "Attach File"); - // - // showModalBottomSheet( - // context: context, - // builder: (BuildContext context) { - // return; - // }, - // ); - // ImageSource? source = await showModalBottomSheet( - // 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: [ - // 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: [ - // 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 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 toJson() { - return { - 'id': id, - 'file': file?.path, - }; + return {'id': id, 'file': file?.path}; } }