Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openContactForm initial value #321

Open
kingkarki opened this issue Jan 25, 2024 · 0 comments
Open

openContactForm initial value #321

kingkarki opened this issue Jan 25, 2024 · 0 comments

Comments

@kingkarki
Copy link

kingkarki commented Jan 25, 2024

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();`

WhatsApp Image 2024-01-25 at 5 45 25 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant