bug fixes attachment can be uploaded at any stage

main_production
WaseemAbbasi22 1 month ago
parent 83eec2c4d5
commit 08dfc807fc

@ -35,14 +35,14 @@ class HelperFunction {
builder: (context) => AssetDeliveryAttachmentView(
tableItemId: deliveryTableItemId,
attachmentType: result!.value,
viewOnly: viewOnly,
// viewOnly: viewOnly,
attachmentList: list,
)));
// }
}
}
static void cancelRequest({required BuildContext context, int ?itemId, int? requestId}) async {
static void cancelRequest({required BuildContext context, int? itemId, int? requestId}) async {
AssetDeliveryProvider assetDeliveryProvider = Provider.of<AssetDeliveryProvider>(context, listen: false);
showDialog(
context: context,
@ -68,7 +68,8 @@ class HelperFunction {
static Future<Lookup?> showAttachmentTypeBottomSheet(BuildContext context) {
return showModalBottomSheet<Lookup?>(
context: context,
isScrollControlled: true,backgroundColor: AppColor.bottomSheetColor(context),
isScrollControlled: true,
backgroundColor: AppColor.bottomSheetColor(context),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),

@ -24,13 +24,13 @@ import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
class AssetDeliveryAttachmentView extends StatefulWidget {
final int? tableItemId;
final int? attachmentType;
bool viewOnly = false;
// bool viewOnly = false;
final List<GenericAttachmentModel> attachmentList;
AssetDeliveryAttachmentView({
super.key,
required this.attachmentList,
this.viewOnly = false,
// this.viewOnly = false,
this.attachmentType,
this.tableItemId,
});
@ -74,51 +74,54 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
},
),
body:
// widget.attachmentList.isEmpty
// ? const NoDataFound().center
// :
Column(
// widget.attachmentList.isEmpty
// ? const NoDataFound().center
// :
Column(
children: [
Flexible(
fit: FlexFit.loose,
child: Column(
children: [
Flexible(
fit: FlexFit.loose,
child: Column(
children: [
widget.attachmentType == 5 && !widget.viewOnly
? AttachmentPicker(
label: context.translation.attachments,
attachment: _attachments,
buttonColor: AppColor.primary10,
onlyImages: false,
showAsListView: true,
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onChange: (attachment) {},
).toShadowContainer(
context,
borderRadius: 20,
padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
)
: FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer(
context,
borderRadius: 20,
padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
],
),
),
if (widget.attachmentType == 5 && !widget.viewOnly)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Save'.addTranslation,
maxWidth: true,
onPressed: _onSavePressed,
),
),
// widget.attachmentType == 5 && !widget.viewOnly
widget.attachmentType == 5 //only add the attachment for current
? AttachmentPicker(
label: context.translation.attachments,
attachment: _attachments,
buttonColor: AppColor.primary10,
onlyImages: false,
showAsListView: true,
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onChange: (attachment) {},
).toShadowContainer(
context,
borderRadius: 20,
padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
)
: _attachments.isNotEmpty
? FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer(
context,
borderRadius: 20,
padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
)
: const NoDataFound().center.expanded,
],
),
),
if (widget.attachmentType == 5)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Save'.addTranslation,
maxWidth: true,
onPressed: _onSavePressed,
),
),
],
),
);
}

@ -160,7 +160,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
maxWidth: true,
// textColor: AppColor.black10,
onPressed: () {
HelperFunction.attachmentTap(context: context, viewOnly: true, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
HelperFunction.attachmentTap(context: context, viewOnly: viewOnly, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
}).expanded,
8.width,
AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap).expanded,

@ -161,13 +161,13 @@ class _TechnicalInspectionLinesListViewState extends State<TechnicalInspectionLi
: Row(
children: [
AppFilledButton(
buttonColor: AppColor.white60,
buttonColor: AppColor.primary10,
label: 'Attachments'.addTranslation,
maxWidth: true,
textColor: AppColor.black10,
// textColor: AppColor.black10,
onPressed: () {
HelperFunction.attachmentTap(
context: context, viewOnly: true, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
context: context, viewOnly: viewOnly, assetDeliveryProvider: assetDeliveryProvider!, deliveryTableItemId: widget.deliveryTableModel.id);
}).expanded,
8.width,
AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap).expanded,

Loading…
Cancel
Save