A complete Flutter application for extracting, enhancing, translating, and converting text using Google ML Kit, TTS, QR/Barcode Scanning, Image Cropping, and PDF Exporting.
The app provides a smooth end-to-end workflow: capture β crop β process β recognize β translate β read aloud β export.
The project follows a feature-based architecture for better organization, scalability, and maintainability.
- Extract text from images using Google ML Kit
- Supports multilingual OCR (Arabic, English, French, Spanish, German, etc.)
- Live camera preview with scanning animation
- High accuracy text recognition with ML Kit Latin script support
- Copy recognized text to clipboard
- Display line count and detection statistics
- Quick enhance button for instant image improvement
- Crop images before processing for better accuracy
- Rotate images left/right
- Multiple aspect ratios (Free, Square)
- Select All: Instantly select full image
- Real-time crop preview
- Smooth, intuitive interface
- Integrated into the capture workflow
- Extract entities from business cards and documents
- Automatic detection of:
- Phone numbers
- Email addresses
- Physical addresses
- URLs and websites
- Names and other entities
- One-tap copy functionality for each detected entity
- Smart icon mapping for different entity types
- Adjust contrast (80-200 range)
- Adjust contrast (80-200 range)
- Modify brightness (1-10 scale)
- Advanced Filters: Grayscale, Sepia, Invert, Blur, Emboss, Sketch, Pixelate
- Real-time preview of adjustments
- Save enhanced images to gallery
- Reset to default values
- Visual sliders with precise value display
- Accessible from recognizer screen for quick edits
- Translate recognized text between multiple languages:
- Arabic, English, French, Spanish, German
- Italian, Portuguese, Russian, Chinese, Japanese
- Smooth UI for switching languages
- Preserve formatting in translations
- Copy translated text to clipboard
- Read recognized or translated text aloud
- Multi-language voice support:
- English (US), Arabic (SA), French (FR), Spanish (ES), German (DE)
- Adjustable speech rate and pitch
- Play/Stop controls with visual feedback
- Individual Playback: Play original and translated text independently
- Auto-Sync: Language automatically matches translation
- Scan QR codes and barcodes from images
- Supports multiple barcode types:
- QR Codes, URLs, WiFi credentials
- Email addresses, Phone numbers, SMS
- Contact information, Calendar events
- Product barcodes (EAN, UPC, etc.)
- One-tap copy functionality
- Smart type detection with custom icons
- Export as PDF (Image): Preserve original image in PDF format
- Export as PDF (Text): Clean text-only PDF document
- Export as TXT: Plain text file export
- Share exported files via system share sheet
- Automatic file naming with timestamps
- Temporary file management
- Beautiful Material Design 3 interface
- Full dark mode support with persistence
- Theme preference saved locally
- Smooth animations using flutter_animate
- Glassmorphism effects and gradient accents
- Responsive design for all screen sizes
- Consistent design language across all screens
- Custom themed components and widgets
- Automatically saves your theme preference (Dark/Light mode)
- Remembers your choice across app restarts
- Uses local storage (SharedPreferences)
- Seamless experience with no flash on startup
- Flutter SDK (>=3.2.6 <4.0.0)
- Dart
- Provider (State Management)
- google_mlkit_text_recognition (^0.15.0) - Text OCR
- google_mlkit_entity_extraction (^0.15.1) - Entity detection
- google_mlkit_barcode_scanning (^0.14.1) - QR/Barcode scanning
- camera (^0.11.3) - Camera access
- image_picker (^1.2.1) - Gallery picker
- image (^4.5.4) - Image manipulation
- crop_your_image (^2.0.0) - Image cropping
- image_gallery_saver_plus (^4.0.1) - Save to gallery
- flutter_tts (^4.2.3) - Text-to-Speech
- translator (^1.0.4+1) - Translation service
- path_provider (^2.1.5) - File system paths
- pdf (^3.11.3) - PDF generation
- share_plus (^12.0.1) - Share functionality
- shared_preferences (^2.2.2) - Local data persistence
- flutter_animate (^4.5.2) - Animations
- url_launcher (^6.3.2) - URL handling
lib/
βββ main.dart # App entry point
βββ core/ # Core app functionality
β βββ providers/
β β βββ theme_provider.dart # Theme state + persistence
β βββ constants/
β β βββ app_constants.dart # App-wide constants
β βββ utils/
β βββ helpers.dart # Helper functions & utilities
β
βββ features/ # Feature modules
β βββ home/
β β βββ home_screen.dart # Main camera & mode selection
β βββ text_recognition/
β β βββ recognizer_screen.dart # Text OCR screen
β βββ card_scanner/
β β βββ card_scanner.dart # Business card scanning
β βββ qr_scanner/
β β βββ scan_qr.dart # QR/Barcode scanning
β βββ image_enhancement/
β β βββ enhance_screen.dart # Image adjustments
β βββ text_to_speech/
β βββ tts_screen.dart # TTS & Translation
β
βββ shared/ # Shared components
βββ widgets/
β βββ loading_indicator.dart # Reusable loading widget
β βββ text_card.dart # Text display card
β βββ custom_button.dart # Custom button widgets
β βββ image_cropper_widget.dart # Image cropping widget
βββ models/
βββ entity_model.dart # Entity data model
βββ barcode_model.dart # Barcode data model
β
Feature Isolation: Each feature is self-contained
β
Reusability: Shared widgets and models reduce duplication
β
Scalability: Easy to add new features without affecting existing code
β
Maintainability: Clear structure makes debugging easier
β
Team Collaboration: Multiple developers can work on different features
β
Testing: Isolated features are easier to test
- Flutter SDK (>=3.2.6)
- Android Studio / VS Code
- Android SDK (for Android development)
- Xcode (for iOS development)
git clone https://github.com/konynour/flutter_ocr.git
cd flutter_ocrflutter clean
flutter pub getEdit android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 21 // Required for ML Kit
targetSdkVersion 34
}
}Ensure these are in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />If you need additional language support, add to android/app/build.gradle:
dependencies {
implementation 'com.google.mlkit:text-recognition:16.0.0'
// Add other language models if needed
// implementation 'com.google.mlkit:text-recognition-chinese:16.0.0'
// implementation 'com.google.mlkit:text-recognition-japanese:16.0.0'
// implementation 'com.google.mlkit:text-recognition-korean:16.0.0'
}Add to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for scanning documents</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required to select images</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Photo library access is required to save images</string>flutter runflutter run --releaseflutter devices
flutter run -d <device-id>flutter build apk --releaseOutput: build/app/outputs/flutter-apk/app-release.apk
flutter build appbundle --releaseOutput: build/app/outputs/bundle/release/app-release.aab
flutter build apk --split-per-abi- Home Screen: Choose scanning mode (Card, Text, QR, Enhance)
- Capture/Select: Use camera or pick from gallery
- Crop Image: Adjust crop area, rotate if needed
- Process: Image is automatically processed
- Results: View recognized text/entities/barcodes
- Actions:
- Copy to clipboard
- Enhance image
- Translate (if applicable)
- Read aloud with TTS
- Export as PDF/TXT
- Share or save
Edit lib/core/providers/theme_provider.dart to customize colors:
// Light Theme Colors
static const Color lightPrimary = Color(0xFF2196F3);
static const Color lightBackground = Color(0xFFF5F7FA);
// Dark Theme Colors
static const Color darkPrimary = Color(0xFF42A5F5);
static const Color darkBackground = Color(0xFF121212);Edit lib/core/constants/app_constants.dart for app-wide settings:
class AppConstants {
static const String appName = 'OCR Scanner';
static const double borderRadius = 16.0;
// Add your custom constants
}- Issue: After translating to Arabic, TTS continues playing in Arabic even when English is selected
- Fix Status: β Fixed (v1.2)
- Issue:
geo:URL format in QR codes not properly supported by ML Kit - Cause: ML Kit limitation + missing custom parser
- Workaround: Code is commented out
- Fix Status: π Planned
- New: Advanced Image Filters (Blur, Emboss, etc.)
- New: "Select All" in Image Cropper
- Fix: TTS Language Sync & Individual Playback
- Fix: Cropper Navigation & Errors
- Image cropping with rotation
- Theme persistence with local storage
- Enhance button in recognizer screen
- Feature-based architecture
- Improved error handling
- Add more crop aspect ratios (4:3, 16:9, etc.)
- Add proper routing with named routes
- Add loading states for all async operations
- Implement batch processing
- Add OCR history feature
- Support for more barcode formats
- Custom geo-location parser for QR codes
- Add unit and widget tests
- Document scanning mode (multi-page)
- Cloud sync for OCR history
- Advanced image filters
- Handwriting recognition
- Receipt/Invoice parsing
- Multi-language UI support
- Offline translation support
- Custom ML model training
flutter testflutter test --coverageflutter drive --target=test_driver/app.dartContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Write clear commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
Yosef Elsersy
- GitHub: @yosefelsersy
Nour Kony
- GitHub: @konynour
Project Link: https://github.com/konynour/flutter_ocr
- Google ML Kit - Machine Learning APIs
- Flutter Team - Amazing framework
- pub.dev - Package repository
- All open-source contributors
If you find this project useful, please consider:
- β Starring the repository
- π Reporting bugs
- π‘ Suggesting new features
- π€ Contributing to the code
- π’ Sharing with others
Perfect your scans with:
- Free-form and fixed aspect ratios
- 90Β° rotation in both directions
- Real-time preview
- Smooth animations
Your preferences matter:
- Automatically saves dark/light mode
- Instant load on app restart
- No flash or flicker
- Seamless experience
Boost your productivity:
- Quick enhance from any screen
- One-tap copy for all results
- Fast mode switching
- Intuitive navigation
Made with β€οΈ using Flutter





