Giter Club home page Giter Club logo

flutter_document_scanner's Introduction

Flutter Document Scanner

Pub build License: MIT


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

Demo


Usage

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

Example

Import libraries.

import 'package:flutter_document_scanner/flutter_document_scanner.dart';

Initialize the DocumentScannerController

  final _controller = DocumentScannerController();

Display widget

DocumentScanner(
  controller: _controller,
  onSave: (Uint8List imageBytes) {
    print("image bytes: $imageBytes");
  },
);

Controller Document uses

Actions

_controller.takePhoto(
  minContourArea: 80000.0,
);

_controller.cropPhoto();

_controller.applyFilter(FilterType.gray);

_controller.savePhotoDocument();

_controller.changePage(AppPages.cropPhoto);

Can listen to the changes

_controller.statusTakePhotoPage.listen((AppStatus event) {
  print("Changes when taking the picture");
  print("[initial, loading, success, failure]");
});


_controller.statusCropPhoto.listen((AppStatus event) {
  print("Changes while cutting the image and adding warp perspective");
  print("[initial, loading, success, failure]");
});


_controller.statusEditPhoto.listen((AppStatus event) {
  print("Changes when editing the image (applying filters)");
  print("[initial, loading, success, failure]");
});


_controller.currentFilterType.listen((FilterType event) {
  print("Listen to the current filter applied on the image");
  print("[ natural, gray, eco]");
});


_controller.statusSavePhotoDocument.listen((AppStatus event) {
  print("Changes while the document image is being saved");
  print("[initial, loading, success, failure]");
});

Customizations

Camera

DocumentScanner(
  controller: _controller,
  onSave: (Uint8List imageBytes) {
    print("image bytes: $imageBytes");
  },
  resolutionCamera: ResolutionPreset.high,
  initialCameraLensDirection: CameraLensDirection.front,
);

Page transitions

DocumentScanner(
  controller: _controller,
  onSave: (Uint8List imageBytes) {
    print("image bytes: $imageBytes");
  },
  pageTransitionBuilder: (child, animation) {
    final tween = Tween(begin: 0.0, end: 1.0);

    final curvedAnimation = CurvedAnimation(
      parent: animation,
      curve: Curves.easeOutCubic,
    );

    return FadeTransition(
      opacity: tween.animate(curvedAnimation),
      child: child,
    );
  },
);

General Styles

The properties are listed here

Page to take the photo

The properties are listed here

Page to crop the image

The properties are listed here

Page to edit image

The properties are listed here

flutter_document_scanner's People

Contributors

criistian14 avatar

Forkers

renovate-bot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.