|
|
|
|
@ -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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|