qr_auto_fill_form 1.1.1
qr_auto_fill_form: ^1.1.1 copied to clipboard
A customizable Flutter package to scan QR codes and auto-fill form fields.
qr_auto_fill_form #
β¨ Overview #
qr_auto_fill_form is a customizable Flutter package that lets users scan QR codes and automatically populate form fields with the decoded data. Ideal for forms in onboarding, vehicle rental, check-ins, ID entry, or automated data collection workflows.
π Features #
- β Full-screen, professional QR scanner screen
- β Auto-fills text fields based on scanned QR JSON data
- β Generate QR-ready data (JSON or keyValue) to use in any QR code generator
- β Copy or display QR data for reuse or sharing
- β Supports clearing fields before scan
- β Optional confirmation dialog before applying scanned data
- β Easy integration into existing forms
- β Supports field-level transformations and validation hooks
- β
Works out-of-the-box with
TextEditingControllers
π¦ Installation #
Add the following to your pubspec.yaml:
dependencies:
qr_auto_fill_form: ^1.1.1
π οΈ Usage #
1. Register your form fields #
final qrFormController = QRFormAutoFillController();
@override
void initState() {
super.initState();
qrFormController.registerField('name', nameController);
qrFormController.registerField('email', emailController);
qrFormController.registerField('numbers', numberController);
qrFormController.registerField('profession', professionController);
}
2. Trigger QR scan and auto-fill #
ElevatedButton(
onPressed: () {
launchQRFormScanner(
context: context,
controller: qrFormController,
onBeforeScan: () {
nameController.clear();
emailController.clear();
licenseController.clear();
carController.clear();
},
showConfirmation: true,
confirmTitle: 'Auto-Fill Form',
confirmContent: 'Do you want to use this scanned data?',
);
},
child: const Text('Scan & Fill'),
);
3. Generate QR-ready data (JSON or keyValue) to use in any QR code generator #
You can also generate a QR string (JSON or key-value) from currently entered form data:
final data = qrFormController.generateQRData(
format: QRDataFormat.json, // or QRDataFormat.keyValue
);
π Pro Tip: #
Even if you donβt want to use a visual QR code, you can still show the formatted string and let users:
Copy it Share it via apps like WhatsApp/Email Store it in a database
π Example QR JSON #
{ "name": "ABC", "email": "ab.dev.pk@gmail.com", "numbers": 123, "profession": "Development" }
π Example keyValue #
name=ABC;email=ab.dev.pk@gmail.com;numbers=123;profession=Development
π License #
This project is licensed under the MIT License. Copyright Β© 2024 Abou Bakar