document_camera_frame 0.1.6 copy "document_camera_frame: ^0.1.6" to clipboard
document_camera_frame: ^0.1.6 copied to clipboard

Flutter package for capturing and cropping document images with a customizable camera interface.

example/lib/main.dart

import 'package:document_camera_frame/document_camera_frame.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(
      debugShowCheckedModeBanner: false,
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Document Capture Frame')),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            // Navigate to the DocumentCameraFrame example screen when the button is pressed
            Navigator.of(context).push(
              MaterialPageRoute(
                  builder: (context) => const DocumentCameraFrameExample()),
            );
          },
          child: const Text('Start Document Capture'),
        ),
      ),
    );
  }
}

class DocumentCameraFrameExample extends StatelessWidget {
  const DocumentCameraFrameExample({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: DocumentCameraFrame(
        // Document frame dimensions
        frameWidth: 300.0,
        frameHeight: 200.0,

        // Title displayed at the top
        title: const Text(
          'Capture Your Document',
          style: TextStyle(
            color: Colors.white,
            fontSize: 20,
            fontWeight: FontWeight.bold,
          ),
        ),

        // Show Close button
        showCloseButton: true,

        // Callback when the document is captured
        onCaptured: (imgPath) {
          debugPrint('Captured image path: $imgPath');
        },

        // Callback when the document is saved
        onSaved: (imgPath) {
          debugPrint('Saved image path: $imgPath');
        },

        // Callback when the retake button is pressed
        onRetake: () {
          debugPrint('Retake button pressed');
        },

        // Optional: Customize Capture button, Save button, etc. if needed
      ),
    );
  }
}
copied to clipboard
29
likes
160
points
312
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.29 - 2025.04.13

Flutter package for capturing and cropping document images with a customizable camera interface.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

camera, cupertino_icons, flutter, flutter_animate, image, path_provider

More

Packages that depend on document_camera_frame