doc_scan_lite 0.0.2
doc_scan_lite: ^0.0.2 copied to clipboard
Lightweight document scanner plugin: live edge detection and perspective crop via classical CV over FFI. No ML models, no Play Services, no OpenCV.
import 'package:doc_scan_lite/doc_scan_lite.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'doc_scan_lite example',
theme: ThemeData(colorSchemeSeed: Colors.teal, useMaterial3: true),
home: const ScannerScreen(),
);
}
}
/// The entire integration: drop in [DocScannerView], handle the captured crop.
/// Camera setup, lifecycle, the live edge overlay, the capture button, the
/// optional drag-to-adjust step, and the result preview are all handled by the
/// widget. `enableManualAdjust: true` inserts the manual corner editor before
/// the final crop.
class ScannerScreen extends StatelessWidget {
const ScannerScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('doc_scan_lite')),
body: DocScannerView(
enableManualAdjust: true,
onCaptured: (CapturedDocument doc) {
debugPrint('Captured ${doc.width}x${doc.height} document');
},
),
);
}
}