# fluttertpc_flutter_qr_reader
**Repository Path**: openharmony-sig/fluttertpc_flutter_qr_reader
## Basic Information
- **Project Name**: fluttertpc_flutter_qr_reader
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 3
- **Created**: 2024-06-25
- **Last Updated**: 2025-05-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 🚨 **重要提示 | IMPORTANT**
>
> **⚠️ 此代码仓已归档。新地址请访问 [fluttertpc_flutter_qr_reader](https://gitcode.com/openharmony-sig/fluttertpc_flutter_qr_reader)。| ⚠️ This repository has been archived. For the new address, please visit [fluttertpc_flutter_qr_reader](https://gitcode.com/openharmony-sig/fluttertpc_flutter_qr_reader).**
>
---
>
# flutter_qr_reader
QR code (scan code / picture) recognition (AndroidView/UiKitView)
## DEMO


## Getting Started
``` dart
import 'package:flutter_qr_reader/flutter_qr_reader.dart';
// 识别图片
final String data = await FlutterQrReader.imgScan(File);
// 嵌入视图
QrReaderView(
width: 320,
height: 350,
callback: (container) {},
)
// 打开手电筒
..setFlashlight
// 开始扫码
..startCamera
// 结束扫码
..stopCamera
```
### For IOS
Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.
io.flutter.embedded_views_preview
YES
And you will need provide the description of camera's permission to work properly, otherwise will crash your app.
```
NSCameraUsageDescription
The porpuse explaining why you will use the camera
```
## Built-in UI
``` dart
Widget build(BuildContext context) {
return new Scaffold(
body: QrcodeReaderView(key: qrViewKey, onScan: onScan),
);
}
GlobalKey qrViewKey = GlobalKey();
Future onScan(String data) async {
await showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text("扫码结果"),
content: Text(data),
actions: [
CupertinoDialogAction(
child: Text("确认"),
onPressed: () => Navigator.pop(context),
)
],
);
},
);
qrViewKey.currentState.startScan();
}
```