flutter_document_scanner 0.0.1 copy "flutter_document_scanner: ^0.0.1" to clipboard
flutter_document_scanner: ^0.0.1 copied to clipboard

outdated

A Flutter plugin that allows the management of taking, cropping and applying filters to an image, using the camera plugin

Flutter Document Scanner #

A Flutter plugin that allows the management of taking, cropping and applying filters to an image, using the Camera plugin.

Usage #

First, add camera and flutter_document_scanner as a dependency in your pubspec.yaml file.

Example #

Import libraries.

import 'package:camera/camera.dart';
import 'package:flutter_document_scanner/flutter_document_scanner.dart';

Initialize the camera controller

  @override
void initState() {
  super.initState();

  _initCamera();
}

void _initCamera() async {
  List<CameraDescription> cameras = await availableCameras();
  _cameraController = CameraController(
    cameras.first,
    ResolutionPreset.high,
    enableAudio: false,
  );

  _cameraController.initialize().then((_) {
    if (!mounted) {
      return;
    }

    setState(() {});
  });
}

Display widget full screen

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: Text(
        "Document Scanner",
      ),
      centerTitle: true,
      elevation: 0,
    ),
    body: SafeArea(
      child: (_cameraController != null)
          ? DocumentScanner(
        cameraController: _cameraController,
        childWidgetTakePicture: Container(
          height: 80,
          width: 80,
          decoration: BoxDecoration(
            color: Colors.black,
            shape: BoxShape.circle,
          ),
          child: Icon(Icons.camera),
        ),
        onLoadingTakingPicture: _onLoadingTakingPicture,
        onTakePicture: _onTakePicture,
        onLoadingCroppingPicture: _onLoadingCroppingPicture,
        onCroppedPicture: _onCroppedPicture,
        onLoadingSavingDocument: _onLoadingSavingDocument,
        onSaveDocument: _onSaveDocument,
      )
          : Container(),
    ),
  );
}

Listen events, only required is onSaveDocument

void _onLoadingTakingPicture() {
  // TODO: show modal when taking picture, or other function
}

void _onTakePicture() {
  // TODO: hide modal when take picture, or other function
}

void _onLoadingCroppingPicture() {
  // TODO: show modal when cropping picture, or other function
}

void _onCroppedPicture() {
  // TODO: hide modal when crop picture, or other function
}

void _onLoadingSavingDocument() {
  // TODO: show modal when saving document, or other function
}

void _onSaveDocument(File document) async {
  // TODO: when save
}
118
likes
0
pub points
90%
popularity

Publisher

unverified uploader

A Flutter plugin that allows the management of taking, cropping and applying filters to an image, using the camera plugin

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

camera, crop_your_image, flutter, opencv_4, path_provider

More

Packages that depend on flutter_document_scanner