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,
}); });
@ -74,51 +74,54 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
}, },
), ),
body: body:
// widget.attachmentList.isEmpty // widget.attachmentList.isEmpty
// ? const NoDataFound().center // ? const NoDataFound().center
// : // :
Column( Column(
children: [
Flexible(
fit: FlexFit.loose,
child: Column(
children: [ children: [
Flexible( // widget.attachmentType == 5 && !widget.viewOnly
fit: FlexFit.loose, widget.attachmentType == 5 //only add the attachment for current
child: Column( ? AttachmentPicker(
children: [ label: context.translation.attachments,
widget.attachmentType == 5 && !widget.viewOnly attachment: _attachments,
? AttachmentPicker( buttonColor: AppColor.primary10,
label: context.translation.attachments, onlyImages: false,
attachment: _attachments, showAsListView: true,
buttonColor: AppColor.primary10, buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onlyImages: false, onChange: (attachment) {},
showAsListView: true, ).toShadowContainer(
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10), context,
onChange: (attachment) {}, borderRadius: 20,
).toShadowContainer( padding: 12,
context, margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
borderRadius: 20, )
padding: 12, : _attachments.isNotEmpty
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), ? FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer(
) context,
: FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []).toShadowContainer( borderRadius: 20,
context, padding: 12,
borderRadius: 20, margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: 12, )
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), : const NoDataFound().center.expanded,
),
],
),
),
if (widget.attachmentType == 5 && !widget.viewOnly)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Save'.addTranslation,
maxWidth: true,
onPressed: _onSavePressed,
),
),
], ],
), ),
),
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, 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