pic_translator 1.0.3+4 copy "pic_translator: ^1.0.3+4" to clipboard
pic_translator: ^1.0.3+4 copied to clipboard

A Flutter plugin for translating text in images from one language to another. It extracts text from images using ML Kit and overlays the translated text on the original image

Pic Translator #

A Flutter plugin for translating text in images from one language to another. This plugin extracts text from images using Google's ML Kit and overlays the translated text on the original image, preserving the original layout and styling.

Features #

Extract text from images using Google's ML Kit Text Recognition
🌍 Translate text to multiple languages
🖼️ Create a new image with translated text overlaid
🎨 Support for custom styling and fonts based on target language
📱 Ready-to-use Flutter widget for quick integration
🗣️ Support for multiple languages including English, Spanish, Hindi, French, German, Japanese, Russian, Arabic, and more

Installation #

Add the dependency to your pubspec.yaml:

dependencies:
  pic_translator: any

Android Setup #

Add the following permissions to your 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" />

iOS Setup #

Add the following keys to your Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera to take photos for translation.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library to select images for translation.</string>

Usage #

Basic Usage with Widget #

The simplest way to use the plugin is with the provided PicTranslatorWidget:

import 'package:flutter/material.dart';
import 'package:pic_translator/pic_translator.dart';

class SimpleExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return PicTranslatorWidget(
      initialTargetLanguage: 'en',
      onTranslationCompleted: (result) {
        print('Translated text: ${result.translatedText}');
      },
      onError: (error) {
        print('Error: $error');
      },
    );
  }
}

Supported Languages #

The plugin currently supports the following languages:

  • English (en)
  • Spanish (es)
  • Hindi (hi)
  • French (fr)
  • German (de)
  • Japanese (ja)
  • Russian (ru)
  • Arabic (ar)
  • Portuguese (pt)
  • Korean (ko)
  • Italian (it)
  • Dutch (nl)
  • Turkish (tr)
  • Vietnamese (vi)
  • Thai (th)

Example App #

Check out the example app in the example folder to see the plugin in action.

3
likes
120
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for translating text in images from one language to another. It extracts text from images using ML Kit and overlays the translated text on the original image

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, google_fonts, google_ml_kit, image, image_picker, path_provider, permission_handler, share_plus, translator

More

Packages that depend on pic_translator