openContactForm initial value
Opened this issue · 0 comments
kingkarki commented
here is my code i wanna fill value in initial when it's open , how can i do this , is it possible in openContactForm?
`Contact newContact = Contact();
if (widget.value.type == BarcodeType.contactInfo) {
ContactInfo contactValue = widget.value.contactInfo!;
newContact.givenName = contactValue.name?.prefix;
newContact.givenName = contactValue.name?.first;
newContact.givenName = contactValue.name?.middle;
newContact.familyName = contactValue.name?.last;
newContact.givenName = contactValue.name?.suffix;
newContact.jobTitle = contactValue.title;
newContact.company = contactValue.organization;
VCardAddress vCa = VCardAddress.parse(widget.value.rawValue!);
newContact.postalAddresses = [
PostalAddress(
city: vCa.city,
country: vCa.country,
label: 'Address',
postcode: vCa.postalCode,
street: vCa.street,
),
];
VCardPhones vCp = VCardPhones.parse(widget.value.rawValue!);
newContact.phones = [
Item(label: 'mobile', value: vCp.cellPhone),
Item(label: 'work', value: vCp.workPhone),
Item(label: 'fax', value: vCp.fax),
];
newContact.emails = [
for (Email email in contactValue.emails)
Item(
label: email.type.toString(),
value: email.address,
),
];
// newContact.
}
// await ContactsService.addContact(newContact);
await ContactsService.openContactForm();`