flutter_text_detect_area
O reconhecimento de texto da área de detecção de texto do Flutter pode reconhecer/detectar texto de uma área específica da imagem movendo ou arrastando o seletor de área.
techvootsolutions/flutter_text_detect_area open-source repository details.
{"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.0Texto original em inglês. Visite o GitHub para a versão atual.
pub package GitHub stars License: GPLv3 Flutter Compatible Platform
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) |
|---|---|
| Pick | Camera |
| Multi Text Detection (PNG) | Single Text Detection Camera (PNG) |
|---|---|
| Multi | Single |
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.