flutter_text_detect_area
Flutter 文本检测区域的文本识别功能可以通过拖动/移动/平移区域选择器,从图像的特定区域识别/检测文本。
techvootsolutions/flutter_text_detect_area open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A Flutter plugin that enables text detection from specific areas of an image or live camera preview. Just drag/select the area you want to scan, and let it extract the text using ML Kit.
Perfect for scanning:
Add to your pubspec.yaml:
dependencies:
flutter_text_detect_area: <latest-version>
Import in your Dart file:
import 'package:flutter_text_detect_area/flutter_text_detect_area.dart';
| Pick Image (GIF) | Live Camera (GIF) |
|---|---|
![]() |
![]() |
| Multi Text Detection (PNG) | Single Text Detection Camera (PNG) |
|---|---|
![]() |
![]() |
Use the image_picker package to choose an image:
final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery);
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SelectImageAreaTextDetect(
detectOnce: true, // Set to false for continuous scan
enableImageInteractions: true,
imagePath: pickedFile?.path ?? '',
onDetectText: (value) {
if (value is String) {
print("Detected: $value");
} else if (value is List<String>) {
for (int i = 0; i < value.length; i++) {
print("${i + 1}. ${value[i]}");
}
}
},
onDetectError: (error) {
if (error is PlatformException &&
(error.message?.contains("InputImage width and height should be at least 32!") ?? false)) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Selected area must be at least 32x32 pixels.")),
);
}
},
),
),
);
AndroidManifest.xml)<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Info.plist)<key>NSCameraUsageDescription</key>
<string>Need camera access for live scanning</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Need photo access to pick images</string>
| Platform | Supported |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| Web | ❌ |
StringList<String>This project is licensed under the GNU GPLv3.
依赖清单 10 项
{"sdk":"flutter"}^2.0.0^0.16.0^6.1.5+1^2.1.5^1.9.1^4.8.0^0.12.0+2{"sdk":"flutter"}^6.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗