Skip to content

neeraj-pilot/native_text_viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native Text Viewer

A Flutter plugin for iOS that enables native text selection on images using iOS Live Text API.

Features

  • Live Text Support (iOS 15+): Automatic text detection and selection
  • Zoom Support: Pinch-to-zoom and double-tap zoom (up to 5x)
  • Auto Text Detection: Shows "No text found" toast if no text detected (iOS 16+)
  • Graceful Fallback (iOS 12-14): Shows compatibility message
  • Full-Screen Viewer: Black background, minimal UI
  • Multiple Sources: File, asset, and network images

Requirements

  • iOS 12.0 or higher
  • Live Text features require iOS 15.0+
  • Flutter 3.3.0 or higher

Installation

Add to your pubspec.yaml:

dependencies:
  native_text_viewer: ^1.0.0

iOS Setup

Add the following permissions to your iOS app's Info.plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photo library to select images for text detection</string>
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to take photos for text detection</string>

Usage

import 'package:native_text_viewer/native_text_viewer.dart';

// Display image with Live Text
NativeTextImageViewer(
  imagePath: '/path/to/image.jpg',
  source: ImageSource.file,
)

Check Live Text Support

// Check if Live Text is supported
bool isSupported = await NativeTextViewer.isLiveTextSupported();

// Get iOS version
String? version = await NativeTextViewer.getIOSVersion();

Image Sources

// From file
NativeTextImageViewer(
  imagePath: '/path/to/image.jpg',
  source: ImageSource.file,
)

// From assets
NativeTextImageViewer(
  imagePath: 'assets/images/receipt.png',
  source: ImageSource.asset,
)

// From network
NativeTextImageViewer(
  imagePath: 'https://example.com/image.jpg',
  source: ImageSource.network,
)

Example App

cd example
flutter run

Features image picker (gallery/camera) with full-screen viewer.

Interactions

iOS 15+:

  • Long press to select text
  • Pinch to zoom / double-tap zoom
  • Copy, translate, look up definitions
  • Tap detected phone numbers, emails, URLs

iOS 16+:

  • Shows "No text found" if no text detected

Platform Support

Platform Support
iOS ✅ (12.0+)
Android
Web
macOS
Windows
Linux

Limitations

  • iOS only (12.0+)
  • Live Text requires iOS 15.0+
  • "No text found" toast requires iOS 16.0+

License

MIT

About

Flutter plugin for iOS native text selection using Live Text API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •