|
|
|
@ -98,9 +98,11 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
vsync: this,
|
|
|
|
vsync: this,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
_animationController.forward();
|
|
|
|
_animationController.forward();
|
|
|
|
|
|
|
|
// if (widget.documentType != null) {
|
|
|
|
|
|
|
|
// documentLookup = widget.documentType;
|
|
|
|
|
|
|
|
// }
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
Provider.of<AttachmentTypeLookupProviderLatest>(context, listen: false).reset();
|
|
|
|
Provider.of<AttachmentTypeLookupProviderLatest>(context, listen: false).reset();
|
|
|
|
log('i am going to reset the value');
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -136,6 +138,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
file: image,
|
|
|
|
file: image,
|
|
|
|
showAsListView: widget.showAsListView,
|
|
|
|
showAsListView: widget.showAsListView,
|
|
|
|
enabled: widget.enabled,
|
|
|
|
enabled: widget.enabled,
|
|
|
|
|
|
|
|
// documentType: widget.documentType != null ? widget.documentType?.name : widget.attachment[index].documentType?.name,
|
|
|
|
documentType: widget.attachment[index].documentType?.name,
|
|
|
|
documentType: widget.attachment[index].documentType?.name,
|
|
|
|
onRemoveTap: (image) {
|
|
|
|
onRemoveTap: (image) {
|
|
|
|
if (!widget.enabled) {
|
|
|
|
if (!widget.enabled) {
|
|
|
|
@ -186,7 +189,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (result != null) {
|
|
|
|
if (result != null) {
|
|
|
|
for (var path in result.paths) {
|
|
|
|
for (var path in result.paths) {
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: File(path!).path, documentType: documentLookup));
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: File(path!).path, documentType: widget.documentType ?? documentLookup));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
@ -229,8 +232,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
return StatefulBuilder(
|
|
|
|
return StatefulBuilder(
|
|
|
|
builder: (BuildContext context, StateSetter setModalState) {
|
|
|
|
builder: (BuildContext context, StateSetter setModalState) {
|
|
|
|
Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
|
|
|
|
Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
|
|
|
|
|
|
|
|
bool isEnabled = !widget.showTypeDropdown ? true : documentLookup != null;
|
|
|
|
bool isEnabled = !widget.showTypeDropdown?true:documentLookup != null;
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -305,7 +307,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
InfoHeader16Widget(widget.pickerTitle),
|
|
|
|
InfoHeader16Widget(widget.pickerTitle),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
if(widget.showTypeDropdown)...[
|
|
|
|
if (widget.showTypeDropdown) ...[
|
|
|
|
SingleItemDropDownMenu<Lookup, AttachmentTypeLookupProviderLatest>(
|
|
|
|
SingleItemDropDownMenu<Lookup, AttachmentTypeLookupProviderLatest>(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
@ -325,7 +327,6 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
const InfoTextLabelWidget(label: 'Please Select Document Type before picking file', color: AppColor.red30),
|
|
|
|
const InfoTextLabelWidget(label: 'Please Select Document Type before picking file', color: AppColor.red30),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
GridView.builder(
|
|
|
|
GridView.builder(
|
|
|
|
padding: const EdgeInsets.only(top: 16, bottom: 0),
|
|
|
|
padding: const EdgeInsets.only(top: 16, bottom: 0),
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
@ -381,7 +382,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
pickedFiles.forEach((pickedFile) {
|
|
|
|
pickedFiles.forEach((pickedFile) {
|
|
|
|
File fileImage = File(pickedFile.path);
|
|
|
|
File fileImage = File(pickedFile.path);
|
|
|
|
|
|
|
|
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path, documentType: documentLookup));
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path, documentType: widget.documentType ?? documentLookup));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
@ -408,7 +409,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> with SingleTickerPr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path, documentType: documentLookup));
|
|
|
|
widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path, documentType: widget.documentType ?? documentLookup));
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
if (widget.onChange != null) {
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
widget.onChange!(widget.attachment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|