生成用于在Flutter中保存联系人的QR码的方法

huangapple go评论69阅读模式
英文:

How to generate QR code which can be used to save contact in flutter

问题

我正在尝试生成一个包含有关个人联系信息的QR码,他们可以分享这个QR码。扫描QR码的人应该被要求保存联系信息。

目前我正在使用qr_flutter库,但它只显示文本,无法创建联系人QR码。

英文:

I'm trying to generate a QR code which contains contact information about people and they can share the QR code.
The person when scans the QR code it should ask the person to save the contact.

Currently I'm using library qr_flutter
But it only shows text and it's not able to create a contact qr code

答案1

得分: 1

这是一个展示使用 qr_flutter 包显示联系人卡片的小示例。

final vcardData = 'BEGIN:VCARD\n'
  'VERSION:3.0\n'
  'N:Doe;John;;Mr.;\n'
  'TEL;TYPE=CELL:+33 0600000000\n'
  'EMAIL:john.doe@example.com\n'
  'END:VCARD';
QrImage(
  data: vcardData,
  version: QrVersions.auto,
  size: 300.0,
  backgroundColor: Colors.white,
  foregroundColor: Colors.black,
  padding: const EdgeInsets.all(25.0),
)

对于这个示例,我使用的是 qr_flutter:4.0.0 版本。

英文:

this is a small example how you can show a contact card with the qr_flutter package.

final vcardData = 'BEGIN:VCARD\n'
  'VERSION:3.0\n'
  'N:Doe;John;;Mr.;\n'
  'TEL;TYPE=CELL:+33 0600000000\n'
  'EMAIL:john.doe@example.com\n'
  'END:VCARD';
QrImage(
  data: vcardData,
  version: QrVersions.auto,
  size: 300.0,
  backgroundColor: Colors.white,
  foregroundColor: Colors.black,
  padding: const EdgeInsets.all(25.0),
)

for this example I use qr_flutter:4.0.0

huangapple
  • 本文由 发表于 2023年3月9日 21:45:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75685450.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定