bug fixes attachment can be uploaded at any stage

main_production_site_api_change
WaseemAbbasi22 2 months ago
parent 83eec2c4d5
commit 08dfc807fc

@ -35,14 +35,14 @@ class HelperFunction {
builder: (context) => AssetDeliveryAttachmentView( builder: (context) => AssetDeliveryAttachmentView(
tableItemId: deliveryTableItemId, tableItemId: deliveryTableItemId,
attachmentType: result!.value, attachmentType: result!.value,
viewOnly: viewOnly, // viewOnly: viewOnly,
attachmentList: list, 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); AssetDeliveryProvider assetDeliveryProvider = Provider.of<AssetDeliveryProvider>(context, listen: false);
showDialog( showDialog(
context: context, context: context,
@ -68,7 +68,8 @@ class HelperFunction {
static Future<Lookup?> showAttachmentTypeBottomSheet(BuildContext context) { static Future<Lookup?> showAttachmentTypeBottomSheet(BuildContext context) {
return showModalBottomSheet<Lookup?>( return showModalBottomSheet<Lookup?>(
context: context, context: context,
isScrollControlled: true,backgroundColor: AppColor.bottomSheetColor(context), isScrollControlled: true,
backgroundColor: AppColor.bottomSheetColor(context),
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)), 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 { class AssetDeliveryAttachmentView extends StatefulWidget {
final int? tableItemId; final int? tableItemId;
final int? attachmentType; final int? attachmentType;
bool viewOnly = false; // bool viewOnly = false;
final List<GenericAttachmentModel> attachmentList; final List<GenericAttachmentModel> attachmentList;
AssetDeliveryAttachmentView({ AssetDeliveryAttachmentView({
super.key, super.key,
required this.attachmentList, required this.attachmentList,
this.viewOnly = false, // this.viewOnly = false,
this.attachmentType, this.attachmentType,
this.tableItemId, this.tableItemId,
}); });
@ -83,7 +83,8 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
fit: FlexFit.loose, fit: FlexFit.loose,
child: Column( child: Column(
children: [ children: [
widget.attachmentType == 5 && !widget.viewOnly // widget.attachmentType == 5 && !widget.viewOnly
widget.attachmentType == 5 //only add the attachment for current
? AttachmentPicker( ? AttachmentPicker(
label: context.translation.attachments, label: context.translation.attachments,
attachment: _attachments, attachment: _attachments,
@ -98,16 +99,18 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
padding: 12, padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
) )
: FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer( : _attachments.isNotEmpty
? FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer(
context, context,
borderRadius: 20, borderRadius: 20,
padding: 12, padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
), )
: const NoDataFound().center.expanded,
], ],
), ),
), ),
if (widget.attachmentType == 5 && !widget.viewOnly) if (widget.attachmentType == 5)
FooterActionButton.footerContainer( FooterActionButton.footerContainer(
context: context, context: context,
child: AppFilledButton( child: AppFilledButton(

@ -160,7 +160,7 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
maxWidth: true, maxWidth: true,
// textColor: AppColor.black10, // textColor: AppColor.black10,
onPressed: () { 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, }).expanded,
8.width, 8.width,
AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap).expanded, AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap).expanded,

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

Loading…
Cancel
Save