diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..5f2fb38
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,25 @@
+---
+name: Bug Report
+about: Create a report to help us improve
+title: "fix: "
+labels: bug
+---
+
+**Description**
+A clear and concise description of what the bug is.
+
+**Steps To Reproduce**
+
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected Behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Additional Context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..3ba13e0
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..6b9372e
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,23 @@
+
+
+## Description
+
+
+
+## Type of Change
+
+
+
+- [ ] โจ New feature (non-breaking change which adds functionality)
+- [ ] ๐ ๏ธ Bug fix (non-breaking change which fixes an issue)
+- [ ] โ Breaking change (fix or feature that would cause existing functionality to change)
+- [ ] ๐งน Code refactor
+- [ ] โ
Build configuration change
+- [ ] ๐ Documentation
+- [ ] ๐๏ธ Chore
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..112f425
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,10 @@
+name: ci
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1
diff --git a/.github/workflows/flutter_document_scanner.yaml b/.github/workflows/flutter_document_scanner.yaml
new file mode 100644
index 0000000..c9e928e
--- /dev/null
+++ b/.github/workflows/flutter_document_scanner.yaml
@@ -0,0 +1,181 @@
+name: flutter_document_scanner
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/flutter_document_scanner.yaml"
+ - "src/flutter_document_scanner/**"
+ push:
+ branches:
+ - main
+ paths:
+ - ".github/workflows/flutter_document_scanner.yaml"
+ - "src/flutter_document_scanner/**"
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
+ with:
+ flutter_channel: stable
+ flutter_version: 3.0.0
+ working_directory: src/flutter_document_scanner
+
+ android:
+ runs-on: macos-latest
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v2
+ with:
+ distribution: "temurin"
+ java-version: "11"
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: AVD Cache
+ uses: actions/cache@v2
+ id: avd-cache
+ with:
+ path: |
+ ~/.android/avd/*
+ ~/.android/adb*
+ key: avd-29
+
+ - name: Cache AVD Snapshot
+ if: steps.avd-cache.outputs.cache-hit != 'true'
+ uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: 29
+ force-avd-creation: false
+ emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
+ disable-animations: false
+ script: echo "Generated AVD snapshot for caching."
+
+ - name: Integration Tests
+ uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: 29
+ script: flutter test integration_test
+ working-directory: src/flutter_document_scanner/example
+
+ ios:
+ runs-on: macos-latest
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: Start Simulator
+ run: open -a Simulator.app
+
+ - name: Integration Tests
+ run: flutter test integration_test -d iPhone
+
+ linux:
+ runs-on: ubuntu-18.04
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Install Dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev liblzma-dev
+
+ - name: Enable desktop support
+ run: flutter config --enable-linux-desktop
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: Integration Tests
+ run: xvfb-run flutter test integration_test -d linux
+
+ macos:
+ runs-on: macos-latest
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Enable desktop support
+ run: flutter config --enable-macos-desktop
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: Integration Tests
+ run: flutter test integration_test -d macos
+
+ web:
+ runs-on: macos-latest
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: Run Chromedriver
+ run: |
+ git clone https://github.com/felangel/web_installers
+ cd web_installers/packages/web_drivers
+ dart pub get
+ dart lib/web_driver_installer.dart chromedriver --install-only
+ ./chromedriver/chromedriver --port=4444 &
+
+ - name: Integration Tests
+ run: flutter drive --driver test_driver/integration_test.dart --target integration_test/app_test.dart -d web-server --browser-name=chrome
+
+ windows:
+ runs-on: windows-2019
+
+ defaults:
+ run:
+ working-directory: src/flutter_document_scanner/example
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: subosito/flutter-action@v2
+
+ - name: Enable desktop support
+ run: flutter config --enable-windows-desktop
+
+ - name: Flutter Doctor
+ run: flutter doctor -v
+
+ - name: Integration Tests
+ run: flutter test integration_test -d windows
diff --git a/.github/workflows/flutter_document_scanner_android.yaml b/.github/workflows/flutter_document_scanner_android.yaml
new file mode 100644
index 0000000..b766a25
--- /dev/null
+++ b/.github/workflows/flutter_document_scanner_android.yaml
@@ -0,0 +1,21 @@
+name: flutter_document_scanner_android
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/flutter_document_scanner_android.yaml"
+ - "src/flutter_document_scanner_android/**"
+ push:
+ branches:
+ - main
+ paths:
+ - ".github/workflows/flutter_document_scanner_android.yaml"
+ - "src/flutter_document_scanner_android/**"
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
+ with:
+ flutter_channel: stable
+ flutter_version: 3.0.0
+ working_directory: src/flutter_document_scanner_android
diff --git a/.github/workflows/flutter_document_scanner_ios.yaml b/.github/workflows/flutter_document_scanner_ios.yaml
new file mode 100644
index 0000000..f9d3f7f
--- /dev/null
+++ b/.github/workflows/flutter_document_scanner_ios.yaml
@@ -0,0 +1,21 @@
+name: flutter_document_scanner_ios
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/flutter_document_scanner_ios.yaml"
+ - "src/flutter_document_scanner_ios/**"
+ push:
+ branches:
+ - main
+ paths:
+ - ".github/workflows/flutter_document_scanner_ios.yaml"
+ - "src/flutter_document_scanner_ios/**"
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
+ with:
+ flutter_channel: stable
+ flutter_version: 3.0.0
+ working_directory: src/flutter_document_scanner_ios
diff --git a/.github/workflows/flutter_document_scanner_platform_interface.yaml b/.github/workflows/flutter_document_scanner_platform_interface.yaml
new file mode 100644
index 0000000..e1b401b
--- /dev/null
+++ b/.github/workflows/flutter_document_scanner_platform_interface.yaml
@@ -0,0 +1,21 @@
+name: flutter_document_scanner_platform_interface
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/flutter_document_scanner_platform_interface.yaml"
+ - "src/flutter_document_scanner_platform_interface/**"
+ push:
+ branches:
+ - main
+ paths:
+ - ".github/workflows/flutter_document_scanner_platform_interface.yaml"
+ - "src/flutter_document_scanner_platform_interface/**"
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
+ with:
+ flutter_channel: stable
+ flutter_version: 3.0.0
+ working_directory: src/flutter_document_scanner_platform_interface
diff --git a/.github/workflows/flutter_document_scanner_web.yaml b/.github/workflows/flutter_document_scanner_web.yaml
new file mode 100644
index 0000000..196db1c
--- /dev/null
+++ b/.github/workflows/flutter_document_scanner_web.yaml
@@ -0,0 +1,21 @@
+name: flutter_document_scanner_web
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/flutter_document_scanner_web.yaml"
+ - "src/flutter_document_scanner_web/**"
+ push:
+ branches:
+ - main
+ paths:
+ - ".github/workflows/flutter_document_scanner_web.yaml"
+ - "src/flutter_document_scanner_web/**"
+
+jobs:
+ build:
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
+ with:
+ flutter_channel: stable
+ flutter_version: 3.0.0
+ working_directory: src/flutter_document_scanner_web
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index 77117e5..0000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: build
-
-on:
- push:
- branches: [master]
- pull_request:
- branches: [master]
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@master
-
- - name: Install and set Flutter version
- uses: subosito/flutter-action@master
- with:
- channel: master
-
- - name: Install Dependencies
- run: flutter pub get
-
- - name: Format
- run: flutter format --set-exit-if-changed .
-
- - name: Analyze
- run: flutter analyze lib test example
-
- - name: Run tests
- run: flutter test --no-pub --coverage --test-randomize-ordering-seed random
-
- - name: Upload coverage to codecov
- uses: codecov/codecov-action@master
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: coverage/lcov.info
diff --git a/.gitignore b/.gitignore
index a247422..4aa0df8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,75 +1,48 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
.DS_Store
.atom/
-.buildlog/
-.history
-.svn/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
.idea/
+.vscode/
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-**/doc/api/
-.dart_tool/
-.flutter-plugins
-.flutter-plugins-dependencies
.packages
-.pub-cache/
.pub/
-build/
+.dart_tool/
+pubspec.lock
+flutter_export_environment.sh
+coverage/
+
+Podfile.lock
+Pods/
+.symlinks/
+**/Flutter/App.framework/
+**/Flutter/ephemeral/
+**/Flutter/Flutter.podspec
+**/Flutter/Flutter.framework/
+**/Flutter/Generated.xcconfig
+**/Flutter/flutter_assets/
-# Android related
-**/android/**/gradle-wrapper.jar
-**/android/.gradle
-**/android/captures/
-**/android/gradlew
-**/android/gradlew.bat
-**/android/local.properties
-**/android/**/GeneratedPluginRegistrant.java
+ServiceDefinitions.json
+xcuserdata/
+**/DerivedData/
-# iOS/XCode related
-**/ios/**/*.mode1v3
-**/ios/**/*.mode2v3
-**/ios/**/*.moved-aside
-**/ios/**/*.pbxuser
-**/ios/**/*.perspectivev3
-**/ios/**/*sync/
-**/ios/**/.sconsign.dblite
-**/ios/**/.tags*
-**/ios/**/.vagrant/
-**/ios/**/DerivedData/
-**/ios/**/Icon?
-**/ios/**/Pods/
-**/ios/**/.symlinks/
-**/ios/**/profile
-**/ios/**/xcuserdata
-**/ios/.generated/
-**/ios/Flutter/App.framework
-**/ios/Flutter/Flutter.framework
-**/ios/Flutter/Flutter.podspec
-**/ios/Flutter/Generated.xcconfig
-**/ios/Flutter/ephemeral
-**/ios/Flutter/app.flx
-**/ios/Flutter/app.zip
-**/ios/Flutter/flutter_assets/
-**/ios/Flutter/flutter_export_environment.sh
-**/ios/ServiceDefinitions.json
-**/ios/Runner/GeneratedPluginRegistrant.*
+local.properties
+keystore.properties
+.gradle/
+gradlew
+gradlew.bat
+gradle-wrapper.jar
+.flutter-plugins-dependencies
+*.iml
+
+generated_plugin_registrant.cc
+generated_plugin_registrant.h
+generated_plugin_registrant.dart
+GeneratedPluginRegistrant.java
+GeneratedPluginRegistrant.h
+GeneratedPluginRegistrant.m
+GeneratedPluginRegistrant.swift
+build/
+.flutter-plugins
-# Exceptions to above rules.
-!**/ios/**/default.mode1v3
-!**/ios/**/default.mode2v3
-!**/ios/**/default.pbxuser
-!**/ios/**/default.perspectivev3
+.project
+.classpath
+.settings
\ No newline at end of file
diff --git a/.metadata b/.metadata
deleted file mode 100644
index cb69e6e..0000000
--- a/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: 02c026b03cd31dd3f867e5faeb7e104cce174c5f
- channel: stable
-
-project_type: package
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 6294cd2..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-MIT License
-
-Copyright 2021 Christian Betancourt Barajas
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
deleted file mode 100644
index 8b658c2..0000000
--- a/README.md
+++ /dev/null
@@ -1,168 +0,0 @@
-# Flutter Document Scanner
-
-
-
-
-
-
-
-
-
-
----
-
-A Flutter plugin that allows the management of taking, cropping and applying filters to an image, using
-the [Camera](https://pub.dev/packages/camera) plugin and [OpenCV](https://opencv.org/)
-
-
-![Demo](https://raw.githubusercontent.com/criistian14/flutter_document_scanner/master/demo_scanner.gif)
-
----
-
-## Usage
-
-First, add flutter_document_scanner as
-a [dependency in your pubspec.yaml file](https://flutter.dev/docs/development/packages-and-plugins/using-packages).
-
-## Example
-
-### Import libraries.
-
-```dart
-import 'package:flutter_document_scanner/flutter_document_scanner.dart';
-```
-
-### Initialize the DocumentScannerController
-
-```dart
- final _controller = DocumentScannerController();
-```
-
-### Display widget
-
-```dart
-DocumentScanner(
- controller: _controller,
- onSave: (Uint8List imageBytes) {
- print("image bytes: $imageBytes");
- },
-);
-```
-
----
-
-## Controller Document uses
-
-### Actions
-
-```dart
-_controller.takePhoto(
- minContourArea: 80000.0,
-);
-
-_controller.cropPhoto();
-
-_controller.applyFilter(FilterType.gray);
-
-_controller.savePhotoDocument();
-
-_controller.changePage(AppPages.cropPhoto);
-```
-
-### Can listen to the changes
-
-```dart
-_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
-
-```dart
-DocumentScanner(
- controller: _controller,
- onSave: (Uint8List imageBytes) {
- print("image bytes: $imageBytes");
- },
- resolutionCamera: ResolutionPreset.high,
- initialCameraLensDirection: CameraLensDirection.front,
-);
-```
-
-
-
-### Page transitions
-
-```dart
-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](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/general_styles.dart)
-
-
-#### Page to take the photo
-
-The properties are listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/take_photo_document_style.dart)
-
-
-#### Page to crop the image
-
-The properties are listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/crop_photo_document_style.dart)
-
-
-#### Page to edit image
-
-The properties are listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/edit_photo_document_style.dart)
-
-
diff --git a/analysis_options.yaml b/analysis_options.yaml
deleted file mode 100644
index a5744c1..0000000
--- a/analysis_options.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-include: package:flutter_lints/flutter.yaml
-
-# Additional information about this file can be found at
-# https://dart.dev/guides/language/analysis-options
diff --git a/android/settings.gradle b/android/settings.gradle
deleted file mode 100644
index 19f09c5..0000000
--- a/android/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'flutter_document_scanner'
diff --git a/demo_scanner.gif b/demo_scanner.gif
deleted file mode 100644
index 7b8e353..0000000
Binary files a/demo_scanner.gif and /dev/null differ
diff --git a/example/README.md b/example/README.md
deleted file mode 100644
index ea22ba2..0000000
--- a/example/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# flutter_document_scanner_example
-
-Demonstrates how to use the flutter_document_scanner plugin.
-
-## Getting Started
-
-This project is a starting point for a Flutter application.
-
-A few resources to get you started if this is your first Flutter project:
-
-- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
-- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
-
-For help getting started with Flutter, view our
-[online documentation](https://flutter.dev/docs), which offers tutorials,
-samples, guidance on mobile development, and a full API reference.
diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml
deleted file mode 100644
index 61b6c4d..0000000
--- a/example/analysis_options.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-# This file configures the analyzer, which statically analyzes Dart code to
-# check for errors, warnings, and lints.
-#
-# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
-# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
-# invoked from the command line by running `flutter analyze`.
-
-# The following line activates a set of recommended lints for Flutter apps,
-# packages, and plugins designed to encourage good coding practices.
-include: package:flutter_lints/flutter.yaml
-
-linter:
- # The lint rules applied to this project can be customized in the
- # section below to disable rules from the `package:flutter_lints/flutter.yaml`
- # included above or to enable additional rules. A list of all available lints
- # and their documentation is published at
- # https://dart-lang.github.io/linter/lints/index.html.
- #
- # Instead of disabling a lint rule for the entire project in the
- # section below, it can also be suppressed for a single line of code
- # or a specific dart file by using the `// ignore: name_of_lint` and
- # `// ignore_for_file: name_of_lint` syntax on the line or in the file
- # producing the lint.
- rules:
- # avoid_print: false # Uncomment to disable the `avoid_print` rule
- # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
-
-# Additional information about this file can be found at
-# https://dart.dev/guides/language/analysis-options
diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig
deleted file mode 100644
index 592ceee..0000000
--- a/example/ios/Flutter/Debug.xcconfig
+++ /dev/null
@@ -1 +0,0 @@
-#include "Generated.xcconfig"
diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig
deleted file mode 100644
index 592ceee..0000000
--- a/example/ios/Flutter/Release.xcconfig
+++ /dev/null
@@ -1 +0,0 @@
-#include "Generated.xcconfig"
diff --git a/example/lib/main.dart b/example/lib/main.dart
deleted file mode 100644
index e2c63a9..0000000
--- a/example/lib/main.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-import 'dart:typed_data';
-
-import 'package:flutter/material.dart';
-import 'package:flutter_document_scanner/flutter_document_scanner.dart';
-
-void main() {
- runApp(const MyApp());
-}
-
-class MyApp extends StatefulWidget {
- const MyApp({Key? key}) : super(key: key);
-
- @override
- State createState() => _MyAppState();
-}
-
-class _MyAppState extends State {
- final _controller = DocumentScannerController();
-
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- debugShowCheckedModeBanner: false,
- theme: ThemeData.light().copyWith(
- primaryColor: Colors.teal,
- ),
- home: Builder(
- builder: (context) {
- return Scaffold(
- body: DocumentScanner(
- controller: _controller,
- generalStyles: const GeneralStyles(
- baseColor: Colors.white,
- ),
- cropPhotoDocumentStyle: CropPhotoDocumentStyle(
- top: MediaQuery.of(context).padding.top,
- ),
- onSave: (Uint8List imageBytes) {
- // ? Bytes of the document/image already processed
- },
- ),
- );
- },
- ),
- );
- }
-}
diff --git a/example/pubspec.lock b/example/pubspec.lock
deleted file mode 100644
index 49e57b9..0000000
--- a/example/pubspec.lock
+++ /dev/null
@@ -1,285 +0,0 @@
-# Generated by pub
-# See https://dart.dev/tools/pub/glossary#lockfile
-packages:
- async:
- dependency: transitive
- description:
- name: async
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.8.2"
- bloc:
- dependency: transitive
- description:
- name: bloc
- url: "https://pub.dartlang.org"
- source: hosted
- version: "8.0.2"
- boolean_selector:
- dependency: transitive
- description:
- name: boolean_selector
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.0"
- camera:
- dependency: transitive
- description:
- name: camera
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.9.4+8"
- camera_platform_interface:
- dependency: transitive
- description:
- name: camera_platform_interface
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.5"
- camera_web:
- dependency: transitive
- description:
- name: camera_web
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.1+1"
- characters:
- dependency: transitive
- description:
- name: characters
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
- clock:
- dependency: transitive
- description:
- name: clock
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.0"
- collection:
- dependency: transitive
- description:
- name: collection
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.15.0"
- cross_file:
- dependency: transitive
- description:
- name: cross_file
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.3.2"
- cupertino_icons:
- dependency: "direct main"
- description:
- name: cupertino_icons
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.4"
- equatable:
- dependency: transitive
- description:
- name: equatable
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.3"
- fake_async:
- dependency: transitive
- description:
- name: fake_async
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.2.0"
- flutter:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_bloc:
- dependency: transitive
- description:
- name: flutter_bloc
- url: "https://pub.dartlang.org"
- source: hosted
- version: "8.0.1"
- flutter_document_scanner:
- dependency: "direct main"
- description:
- path: ".."
- relative: true
- source: path
- version: "0.1.0"
- flutter_lints:
- dependency: "direct dev"
- description:
- name: flutter_lints
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.4"
- flutter_plugin_android_lifecycle:
- dependency: transitive
- description:
- name: flutter_plugin_android_lifecycle
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.5"
- flutter_test:
- dependency: "direct dev"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_web_plugins:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.0"
- js:
- dependency: transitive
- description:
- name: js
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.6.3"
- lints:
- dependency: transitive
- description:
- name: lints
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.1"
- matcher:
- dependency: transitive
- description:
- name: matcher
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.12.11"
- meta:
- dependency: transitive
- description:
- name: meta
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.7.0"
- nested:
- dependency: transitive
- description:
- name: nested
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.0"
- path:
- dependency: transitive
- description:
- name: path
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.8.0"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.11.1"
- plugin_platform_interface:
- dependency: transitive
- description:
- name: plugin_platform_interface
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.2"
- provider:
- dependency: transitive
- description:
- name: provider
- url: "https://pub.dartlang.org"
- source: hosted
- version: "6.0.2"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.0.1+1"
- sky_engine:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.99"
- source_span:
- dependency: transitive
- description:
- name: source_span
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.8.1"
- stack_trace:
- dependency: transitive
- description:
- name: stack_trace
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.10.0"
- stream_channel:
- dependency: transitive
- description:
- name: stream_channel
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.0"
- stream_transform:
- dependency: transitive
- description:
- name: stream_transform
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
- string_scanner:
- dependency: transitive
- description:
- name: string_scanner
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.0"
- term_glyph:
- dependency: transitive
- description:
- name: term_glyph
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.2.0"
- test_api:
- dependency: transitive
- description:
- name: test_api
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.4.3"
- typed_data:
- dependency: transitive
- description:
- name: typed_data
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.0"
- vector_math:
- dependency: transitive
- description:
- name: vector_math
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.1"
-sdks:
- dart: ">=2.15.1 <3.0.0"
- flutter: ">=2.5.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
deleted file mode 100644
index 1211fdf..0000000
--- a/example/pubspec.yaml
+++ /dev/null
@@ -1,84 +0,0 @@
-name: flutter_document_scanner_example
-description: Demonstrates how to use the flutter_document_scanner plugin.
-
-# The following line prevents the package from being accidentally published to
-# pub.dev using `flutter pub publish`. This is preferred for private packages.
-publish_to: 'none' # Remove this line if you wish to publish to pub.dev
-
-environment:
- sdk: ">=2.15.1 <3.0.0"
-
-# Dependencies specify other packages that your package needs in order to work.
-# To automatically upgrade your package dependencies to the latest versions
-# consider running `flutter pub upgrade --major-versions`. Alternatively,
-# dependencies can be manually updated by changing the version numbers below to
-# the latest version available on pub.dev. To see which dependencies have newer
-# versions available, run `flutter pub outdated`.
-dependencies:
- flutter:
- sdk: flutter
-
- flutter_document_scanner:
- # When depending on this package from a real application you should use:
- # flutter_document_scanner: ^x.y.z
- # See https://dart.dev/tools/pub/dependencies#version-constraints
- # The example app is bundled with the plugin so we use a path dependency on
- # the parent directory to use the current plugin's version.
- path: ../
-
- # The following adds the Cupertino Icons font to your application.
- # Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^1.0.2
-
-dev_dependencies:
- flutter_test:
- sdk: flutter
-
- # The "flutter_lints" package below contains a set of recommended lints to
- # encourage good coding practices. The lint set provided by the package is
- # activated in the `analysis_options.yaml` file located at the root of your
- # package. See that file for information about deactivating specific lint
- # rules and activating additional ones.
- flutter_lints: ^1.0.0
-
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter.
-flutter:
-
- # The following line ensures that the Material Icons font is
- # included with your application, so that you can use the icons in
- # the material Icons class.
- uses-material-design: true
-
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
-
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.dev/assets-and-images/#resolution-aware.
-
- # For details regarding adding assets from package dependencies, see
- # https://flutter.dev/assets-and-images/#from-packages
-
- # To add custom fonts to your application, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts from package dependencies,
- # see https://flutter.dev/custom-fonts/#from-packages
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
deleted file mode 100644
index 356a50a..0000000
--- a/example/test/widget_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// This is a basic Flutter widget test.
-//
-// To perform an interaction with a widget in your test, use the WidgetTester
-// utility that Flutter provides. For example, you can send tap and scroll
-// gestures. You can also use WidgetTester to find child widgets in the widget
-// tree, read text, and verify that the values of widget properties are correct.
-
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:flutter_document_scanner_example/main.dart';
-
-void main() {
- testWidgets('Verify Platform version', (WidgetTester tester) async {
- // Build our app and trigger a frame.
- await tester.pumpWidget(const MyApp());
-
- // Verify that platform version is retrieved.
- expect(
- find.byWidgetPredicate(
- (Widget widget) =>
- widget is Text && widget.data!.startsWith('Running on:'),
- ),
- findsOneWidget,
- );
- });
-}
diff --git a/CHANGELOG.md b/flutter_document_scanner/CHANGELOG.md
similarity index 50%
rename from CHANGELOG.md
rename to flutter_document_scanner/CHANGELOG.md
index 164e06d..f8dc73d 100644
--- a/CHANGELOG.md
+++ b/flutter_document_scanner/CHANGELOG.md
@@ -1,7 +1,10 @@
+## 1.0.0
+* Stable version with basic functionality and new structure
+
## 0.1.0
* Removing packages and adjusting opencv functionality (findContours)
## 0.0.1
-* Initial release.
+* Initial release.
\ No newline at end of file
diff --git a/flutter_document_scanner/LICENSE b/flutter_document_scanner/LICENSE
new file mode 100644
index 0000000..96ff66a
--- /dev/null
+++ b/flutter_document_scanner/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Christian Betancourt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/flutter_document_scanner/README.md b/flutter_document_scanner/README.md
new file mode 100644
index 0000000..5ba488e
--- /dev/null
+++ b/flutter_document_scanner/README.md
@@ -0,0 +1,235 @@
+# Flutter Document Scanner
+
+![pub_version]
+![coverage][coverage_badge]
+[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
+[![License: MIT][license_badge]][license_link]
+
+Generated by the [Very Good CLI][very_good_cli_link] ๐ค
+
+---
+
+๐ง Under Development! ๐ง
+
+A Flutter plugin that allows the management of taking, cropping and applying filters to an image, using
+the [Camera][camera_link] plugin.
+
+For Android use [OpenCV][opencv_link].
+
+For iOS use [Vision Kit][vision_kit_link].
+
+
+
+
+## Basic
+![demo]
+
+
+## With Customizations
+![demo_customizations]
+
+
+---
+
+## TODO
+
+| Feature | Android | iOS |
+|-------------------------------|:-------:|:---:|
+| Adjust perspective | โ
| โ
|
+| Apply filters | โ
| โ
|
+| Select image from gallery | โ | โ |
+| Add Unit Test | โ | โ |
+| Find contours in real time | โ | โ |
+| Taking multiple photos at once | โ | โ |
+| Share photos taken | โ | โ |
+| Generate PDF | โ | โ |
+
+## Usage
+
+First, add flutter_document_scanner as
+a [dependency in your pubspec.yaml file](https://flutter.dev/docs/development/packages-and-plugins/using-packages).
+
+Later add [camera permissions](https://pub.dev/packages/camera#installation) in the AndroidManifest.xml and Info.plist files.
+
+
+## Example
+
+### Import libraries.
+
+```dart
+import 'package:flutter_document_scanner/flutter_document_scanner.dart';
+```
+
+### Initialize the DocumentScannerController
+
+```dart
+final _controller = DocumentScannerController();
+```
+
+### Display widget
+
+```dart
+DocumentScanner(
+ controller: _controller,
+ onSave: (Uint8List imageBytes) {
+ print("image bytes: $imageBytes");
+ },
+);
+```
+
+---
+
+## Controller Document uses
+
+### Actions
+
+```dart
+_controller.takePhoto(minContourArea: 80000.0,);
+
+_controller.cropPhoto();
+
+_controller.applyFilter(FilterType.gray);
+
+_controller.savePhotoDocument();
+
+_controller.changePage(AppPages.cropPhoto);
+```
+
+### Can listen to the changes
+
+```dart
+_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
+
+### Change messsages dialogs
+
+```dart
+DocumentScanner(
+ controller: _controller,
+ onSave: (Uint8List imageBytes) {
+ print("image bytes: $imageBytes");
+ },
+ generalStyles: const GeneralStyles(
+ messageTakingPicture: 'Capturando documento',
+ messageCroppingPicture: 'Recortando documento',
+ messageEditingPicture: 'Editando documento',
+ messageSavingPicture: 'Guardando documento',
+ ),
+);
+```
+
+### Camera
+
+```dart
+DocumentScanner(
+ controller: _controller,
+ onSave: (Uint8List imageBytes) {
+ print("image bytes: $imageBytes");
+ },
+ resolutionCamera: ResolutionPreset.high,
+ initialCameraLensDirection: CameraLensDirection.front,
+);
+```
+
+### Page transitions
+
+```dart
+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](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/general_styles.dart)
+
+#### Page to take the photo
+
+The properties are
+listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/take_photo_document_style.dart)
+
+#### Page to crop the image
+
+The properties are
+listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/crop_photo_document_style.dart)
+
+#### Page to edit image
+
+The properties are
+listed [here](https://github.com/criistian14/flutter_document_scanner/blob/master/lib/src/utils/edit_photo_document_style.dart)
+
+
+[pub_version]: https://img.shields.io/pub/v/flutter_document_scanner.svg
+
+[workflow_badge]: https://github.com/criistian14/flutter_document_scanner/actions/workflows/main.yml/badge.svg
+
+[demo]: https://media.giphy.com/media/flQWXeHif35IsSQOOO/giphy.gif
+
+[demo_customizations]: https://media.giphy.com/media/rS6qYbtuuRbo8Fra3d/giphy.gif
+
+[coverage_badge]: https://codecov.io/gh/criistian14/flutter_document_scanner/branch/master/graph/badge.svg?token=2U7891NVMO
+
+[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
+
+[license_link]: https://opensource.org/licenses/MIT
+
+[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
+
+[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis
+
+[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli
+
+[camera_link]: https://pub.dev/packages/camera
+
+[opencv_link]: https://opencv.org/
+
+[vision_kit_link]: https://developer.apple.com/documentation/visionkit
diff --git a/flutter_document_scanner/analysis_options.yaml b/flutter_document_scanner/analysis_options.yaml
new file mode 100644
index 0000000..359af7f
--- /dev/null
+++ b/flutter_document_scanner/analysis_options.yaml
@@ -0,0 +1,7 @@
+include: package:very_good_analysis/analysis_options.3.0.1.yaml
+
+linter:
+ rules:
+ sort_pub_dependencies: false
+ omit_local_variable_types: false
+ lines_longer_than_80_chars: false
diff --git a/example/.gitignore b/flutter_document_scanner/example/.gitignore
similarity index 100%
rename from example/.gitignore
rename to flutter_document_scanner/example/.gitignore
diff --git a/example/.metadata b/flutter_document_scanner/example/.metadata
similarity index 82%
rename from example/.metadata
rename to flutter_document_scanner/example/.metadata
index fd70cab..0a999ee 100644
--- a/example/.metadata
+++ b/flutter_document_scanner/example/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
+ revision: db747aa1331bd95bc9b3874c842261ca2d302cd5
channel: stable
project_type: app
diff --git a/flutter_document_scanner/example/README.md b/flutter_document_scanner/example/README.md
new file mode 100644
index 0000000..f8fdcec
--- /dev/null
+++ b/flutter_document_scanner/example/README.md
@@ -0,0 +1,3 @@
+# flutter_document_scanner_example
+
+Demonstrates how to use the flutter_document_scanner plugin.
diff --git a/flutter_document_scanner/example/analysis_options.yaml b/flutter_document_scanner/example/analysis_options.yaml
new file mode 100644
index 0000000..77fb8e1
--- /dev/null
+++ b/flutter_document_scanner/example/analysis_options.yaml
@@ -0,0 +1,4 @@
+include: package:very_good_analysis/analysis_options.3.0.1.yaml
+linter:
+ rules:
+ public_member_api_docs: false
diff --git a/example/android/.gitignore b/flutter_document_scanner/example/android/.gitignore
similarity index 100%
rename from example/android/.gitignore
rename to flutter_document_scanner/example/android/.gitignore
diff --git a/example/android/app/build.gradle b/flutter_document_scanner/example/android/app/build.gradle
similarity index 95%
rename from example/android/app/build.gradle
rename to flutter_document_scanner/example/android/app/build.gradle
index e5593fc..800240c 100644
--- a/example/android/app/build.gradle
+++ b/flutter_document_scanner/example/android/app/build.gradle
@@ -43,7 +43,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.example.flutter_document_scanner_example"
+ applicationId "com.christian.flutter.document.flutterDocumentScanner.example"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
diff --git a/example/android/app/src/profile/AndroidManifest.xml b/flutter_document_scanner/example/android/app/src/debug/AndroidManifest.xml
similarity index 82%
rename from example/android/app/src/profile/AndroidManifest.xml
rename to flutter_document_scanner/example/android/app/src/debug/AndroidManifest.xml
index 476c586..20ed663 100644
--- a/example/android/app/src/profile/AndroidManifest.xml
+++ b/flutter_document_scanner/example/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.christian.flutter.document.scanner.example">
diff --git a/example/android/app/src/main/AndroidManifest.xml b/flutter_document_scanner/example/android/app/src/main/AndroidManifest.xml
similarity index 96%
rename from example/android/app/src/main/AndroidManifest.xml
rename to flutter_document_scanner/example/android/app/src/main/AndroidManifest.xml
index d96d9e8..28badc4 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/flutter_document_scanner/example/android/app/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.christian.flutter.document.scanner.example">
+ package="com.christian.flutter.document.scanner">
diff --git a/example/android/build.gradle b/flutter_document_scanner/example/android/build.gradle
similarity index 94%
rename from example/android/build.gradle
rename to flutter_document_scanner/example/android/build.gradle
index 24047dc..4256f91 100644
--- a/example/android/build.gradle
+++ b/flutter_document_scanner/example/android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
- ext.kotlin_version = '1.3.50'
+ ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
diff --git a/example/android/gradle.properties b/flutter_document_scanner/example/android/gradle.properties
similarity index 100%
rename from example/android/gradle.properties
rename to flutter_document_scanner/example/android/gradle.properties
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/flutter_document_scanner/example/android/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from example/android/gradle/wrapper/gradle-wrapper.properties
rename to flutter_document_scanner/example/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/example/android/settings.gradle b/flutter_document_scanner/example/android/settings.gradle
similarity index 100%
rename from example/android/settings.gradle
rename to flutter_document_scanner/example/android/settings.gradle
diff --git a/flutter_document_scanner/example/integration_test/app_test.dart b/flutter_document_scanner/example/integration_test/app_test.dart
new file mode 100644
index 0000000..5078c09
--- /dev/null
+++ b/flutter_document_scanner/example/integration_test/app_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+import 'dart:io';
+
+import 'package:flutter_document_scanner_example/main.dart' as app;
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ group('E2E', () {
+ testWidgets('getPlatformName', (tester) async {
+ app.main();
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Get Platform Name'));
+ await tester.pumpAndSettle();
+ final expected = expectedPlatformName();
+ await tester.ensureVisible(find.text('Platform Name: $expected'));
+ });
+ });
+}
+
+String expectedPlatformName() {
+ if (isWeb) return 'Web';
+ if (Platform.isAndroid) return 'Android';
+ if (Platform.isIOS) return 'iOS';
+ throw UnsupportedError('Unsupported platform ${Platform.operatingSystem}');
+}
+
+bool get isWeb => identical(0, 0.0);
diff --git a/example/ios/.gitignore b/flutter_document_scanner/example/ios/.gitignore
similarity index 100%
rename from example/ios/.gitignore
rename to flutter_document_scanner/example/ios/.gitignore
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/flutter_document_scanner/example/ios/Flutter/AppFrameworkInfo.plist
similarity index 96%
rename from example/ios/Flutter/AppFrameworkInfo.plist
rename to flutter_document_scanner/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f..9625e10 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/flutter_document_scanner/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 11.0
diff --git a/flutter_document_scanner/example/ios/Flutter/Debug.xcconfig b/flutter_document_scanner/example/ios/Flutter/Debug.xcconfig
new file mode 100644
index 0000000..ec97fc6
--- /dev/null
+++ b/flutter_document_scanner/example/ios/Flutter/Debug.xcconfig
@@ -0,0 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
+#include "Generated.xcconfig"
diff --git a/flutter_document_scanner/example/ios/Flutter/Release.xcconfig b/flutter_document_scanner/example/ios/Flutter/Release.xcconfig
new file mode 100644
index 0000000..c4855bf
--- /dev/null
+++ b/flutter_document_scanner/example/ios/Flutter/Release.xcconfig
@@ -0,0 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
+#include "Generated.xcconfig"
diff --git a/flutter_document_scanner/example/ios/Podfile b/flutter_document_scanner/example/ios/Podfile
new file mode 100644
index 0000000..313ea4a
--- /dev/null
+++ b/flutter_document_scanner/example/ios/Podfile
@@ -0,0 +1,41 @@
+# Uncomment this line to define a global platform for your project
+platform :ios, '11.0'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+project 'Runner', {
+ 'Debug' => :debug,
+ 'Profile' => :release,
+ 'Release' => :release,
+}
+
+def flutter_root
+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
+ end
+
+ File.foreach(generated_xcode_build_settings_path) do |line|
+ matches = line.match(/FLUTTER_ROOT\=(.*)/)
+ return matches[1].strip if matches
+ end
+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
+end
+
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
+
+flutter_ios_podfile_setup
+
+target 'Runner' do
+ use_frameworks!
+ use_modular_headers!
+
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
+end
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ flutter_additional_ios_build_settings(target)
+ end
+end
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/flutter_document_scanner/example/ios/Runner.xcodeproj/project.pbxproj
similarity index 80%
rename from example/ios/Runner.xcodeproj/project.pbxproj
rename to flutter_document_scanner/example/ios/Runner.xcodeproj/project.pbxproj
index 0e1a15e..4efe72c 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/flutter_document_scanner/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,12 +3,13 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 6578EEA2C83B6388B886968C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D6986157739D9687AB6AFD6 /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
@@ -31,10 +32,12 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 1D6986157739D9687AB6AFD6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 92B43DD0AD58E6356D15892C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -42,6 +45,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ C32DC939DE75A0BDF7B647A4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
+ FC95DB849BF641CAD26B8123 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -49,12 +54,31 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 6578EEA2C83B6388B886968C /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 71A9A1607E036E391BA6A301 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6986157739D9687AB6AFD6 /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 9567CFDD8F7714B0D403105A /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 92B43DD0AD58E6356D15892C /* Pods-Runner.debug.xcconfig */,
+ C32DC939DE75A0BDF7B647A4 /* Pods-Runner.release.xcconfig */,
+ FC95DB849BF641CAD26B8123 /* Pods-Runner.profile.xcconfig */,
+ );
+ path = Pods;
+ sourceTree = "";
+ };
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -72,6 +96,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
+ 9567CFDD8F7714B0D403105A /* Pods */,
+ 71A9A1607E036E391BA6A301 /* Frameworks */,
);
sourceTree = "";
};
@@ -105,12 +131,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
+ 0266454444A641F4EB110FC5 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ 40760E14F3E664153DAD2ABC /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -127,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1300;
+ LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -169,12 +197,36 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 0266454444A641F4EB110FC5 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -183,8 +235,26 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
+ 40760E14F3E664153DAD2ABC /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -272,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -288,13 +358,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = WHL7MM7SCY;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDocumentScannerExample;
+ PRODUCT_BUNDLE_IDENTIFIER = com.christian.flutter.document.scanner;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -349,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -398,7 +470,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -416,13 +488,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = WHL7MM7SCY;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDocumentScannerExample;
+ PRODUCT_BUNDLE_IDENTIFIER = com.christian.flutter.document.scanner;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -438,13 +512,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = WHL7MM7SCY;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDocumentScannerExample;
+ PRODUCT_BUNDLE_IDENTIFIER = com.christian.flutter.document.scanner;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
rename to flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
rename to flutter_document_scanner/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_document_scanner/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
similarity index 99%
rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
rename to flutter_document_scanner/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index c87d15a..a6b826d 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/flutter_document_scanner/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
+
+
diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_document_scanner/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
similarity index 100%
rename from example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
rename to flutter_document_scanner/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_document_scanner/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
similarity index 100%
rename from example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
rename to flutter_document_scanner/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/example/ios/Runner/AppDelegate.swift b/flutter_document_scanner/example/ios/Runner/AppDelegate.swift
similarity index 100%
rename from example/ios/Runner/AppDelegate.swift
rename to flutter_document_scanner/example/ios/Runner/AppDelegate.swift
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
rename to flutter_document_scanner/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/flutter_document_scanner/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
similarity index 100%
rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard
rename to flutter_document_scanner/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/flutter_document_scanner/example/ios/Runner/Base.lproj/Main.storyboard
similarity index 100%
rename from example/ios/Runner/Base.lproj/Main.storyboard
rename to flutter_document_scanner/example/ios/Runner/Base.lproj/Main.storyboard
diff --git a/example/ios/Runner/Info.plist b/flutter_document_scanner/example/ios/Runner/Info.plist
similarity index 86%
rename from example/ios/Runner/Info.plist
rename to flutter_document_scanner/example/ios/Runner/Info.plist
index 9db8694..43a8c5d 100644
--- a/example/ios/Runner/Info.plist
+++ b/flutter_document_scanner/example/ios/Runner/Info.plist
@@ -5,7 +5,7 @@
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
- Flutter Document Scanner
+ Example
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
@@ -13,7 +13,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- flutter_document_scanner_example
+ example
CFBundlePackageType
APPL
CFBundleShortVersionString
@@ -42,6 +42,12 @@
UIInterfaceOrientationLandscapeRight
UIViewControllerBasedStatusBarAppearance
+
+ CADisableMinimumFrameDurationOnPhone
+ UIApplicationSupportsIndirectInputEvents
+
+ NSCameraUsageDescription
+ To scan documents
diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/flutter_document_scanner/example/ios/Runner/Runner-Bridging-Header.h
similarity index 100%
rename from example/ios/Runner/Runner-Bridging-Header.h
rename to flutter_document_scanner/example/ios/Runner/Runner-Bridging-Header.h
diff --git a/flutter_document_scanner/example/lib/main.dart b/flutter_document_scanner/example/lib/main.dart
new file mode 100644
index 0000000..d46563d
--- /dev/null
+++ b/flutter_document_scanner/example/lib/main.dart
@@ -0,0 +1,67 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_document_scanner_example/pages/basic_page.dart';
+import 'package:flutter_document_scanner_example/pages/custom_page.dart';
+
+void main() {
+ runApp(const MyApp());
+}
+
+class MyApp extends StatelessWidget {
+ const MyApp({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: ThemeData.light().copyWith(
+ primaryColor: Colors.teal,
+ ),
+ title: 'Flutter Document Scanner',
+ home: Builder(
+ builder: (context) {
+ return Scaffold(
+ body: Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ // * Basic example page
+ ElevatedButton(
+ onPressed: () => Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (BuildContext context) => const BasicPage(),
+ ),
+ ),
+ child: const Text(
+ 'Basic example',
+ ),
+ ),
+
+ // * Custom example page
+ ElevatedButton(
+ onPressed: () => Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const CustomPage(),
+ ),
+ ),
+ child: const Text(
+ 'Custom example',
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ },
+ ),
+ );
+ }
+}
diff --git a/flutter_document_scanner/example/lib/pages/basic_page.dart b/flutter_document_scanner/example/lib/pages/basic_page.dart
new file mode 100644
index 0000000..3d342c2
--- /dev/null
+++ b/flutter_document_scanner/example/lib/pages/basic_page.dart
@@ -0,0 +1,30 @@
+import 'dart:typed_data';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_document_scanner/flutter_document_scanner.dart';
+
+class BasicPage extends StatefulWidget {
+ const BasicPage({super.key});
+
+ @override
+ State createState() => _BasicPageState();
+}
+
+class _BasicPageState extends State {
+ final _controller = DocumentScannerController();
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: DocumentScanner(
+ controller: _controller,
+ cropPhotoDocumentStyle: CropPhotoDocumentStyle(
+ top: MediaQuery.of(context).padding.top,
+ ),
+ onSave: (Uint8List imageBytes) {
+ // ? Bytes of the document/image already processed
+ },
+ ),
+ );
+ }
+}
diff --git a/flutter_document_scanner/example/lib/pages/custom_page.dart b/flutter_document_scanner/example/lib/pages/custom_page.dart
new file mode 100644
index 0000000..d5df580
--- /dev/null
+++ b/flutter_document_scanner/example/lib/pages/custom_page.dart
@@ -0,0 +1,109 @@
+import 'dart:typed_data';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_document_scanner/flutter_document_scanner.dart';
+
+class CustomPage extends StatefulWidget {
+ const CustomPage({super.key});
+
+ @override
+ State createState() => _CustomPageState();
+}
+
+class _CustomPageState extends State {
+ final _controller = DocumentScannerController();
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: DocumentScanner(
+ controller: _controller,
+ generalStyles: const GeneralStyles(
+ hideDefaultBottomNavigation: true,
+ messageTakingPicture: 'Taking picture of document',
+ messageCroppingPicture: 'Cropping picture of document',
+ messageEditingPicture: 'Editing picture of document',
+ messageSavingPicture: 'Saving picture of document',
+ baseColor: Colors.teal,
+ ),
+ takePhotoDocumentStyle: TakePhotoDocumentStyle(
+ top: MediaQuery.of(context).padding.top + 25,
+ hideDefaultButtonTakePicture: true,
+ onLoading: const CircularProgressIndicator(
+ color: Colors.white,
+ ),
+ children: [
+ // * AppBar
+ Positioned(
+ top: 0,
+ left: 0,
+ right: 0,
+ child: Container(
+ color: Colors.teal,
+ padding: EdgeInsets.only(
+ top: MediaQuery.of(context).padding.top + 10,
+ bottom: 15,
+ ),
+ child: const Center(
+ child: Text(
+ 'Take a picture of the document',
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 20,
+ ),
+ ),
+ ),
+ ),
+ ),
+
+ // * Button to take picture
+ Positioned(
+ bottom: MediaQuery.of(context).padding.bottom + 10,
+ left: 0,
+ right: 0,
+ child: Center(
+ child: ElevatedButton(
+ onPressed: _controller.takePhoto,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.teal,
+ ),
+ child: const Text(
+ 'Take picture',
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 20,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ cropPhotoDocumentStyle: CropPhotoDocumentStyle(
+ top: MediaQuery.of(context).padding.top,
+ maskColor: Colors.teal.withOpacity(0.2),
+ ),
+ editPhotoDocumentStyle: EditPhotoDocumentStyle(
+ top: MediaQuery.of(context).padding.top,
+ ),
+ resolutionCamera: ResolutionPreset.ultraHigh,
+ pageTransitionBuilder: (child, animation) {
+ final tween = Tween(begin: 0, end: 1);
+
+ final curvedAnimation = CurvedAnimation(
+ parent: animation,
+ curve: Curves.easeOutCubic,
+ );
+
+ return ScaleTransition(
+ scale: tween.animate(curvedAnimation),
+ child: child,
+ );
+ },
+ onSave: (Uint8List imageBytes) {
+ // ? Bytes of the document/image already processed
+ },
+ ),
+ );
+ }
+}
diff --git a/flutter_document_scanner/example/pubspec.yaml b/flutter_document_scanner/example/pubspec.yaml
new file mode 100644
index 0000000..b5491b2
--- /dev/null
+++ b/flutter_document_scanner/example/pubspec.yaml
@@ -0,0 +1,31 @@
+name: flutter_document_scanner_example
+description: Demonstrates how to use the flutter_document_scanner plugin.
+version: 0.5.0
+publish_to: none
+
+environment:
+ sdk: ">=2.17.0 <3.0.0"
+ flutter: ">=3.0.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+ flutter_document_scanner:
+ # When depending on this package from a real application you should use:
+ # flutter_document_scanner: ^x.y.z
+ # See https://dart.dev/tools/pub/dependencies#version-constraints
+ # The example app is bundled with the plugin so we use a path dependency on
+ # the parent directory to use the current plugin's version.
+ path: ../
+
+dev_dependencies:
+ flutter_driver:
+ sdk: flutter
+ flutter_test:
+ sdk: flutter
+ integration_test:
+ sdk: flutter
+ very_good_analysis: ^3.0.1
+
+flutter:
+ uses-material-design: true
diff --git a/flutter_document_scanner/example/test_driver/integration_test.dart b/flutter_document_scanner/example/test_driver/integration_test.dart
new file mode 100644
index 0000000..5f39da2
--- /dev/null
+++ b/flutter_document_scanner/example/test_driver/integration_test.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+import 'package:integration_test/integration_test_driver.dart';
+
+Future main() => integrationDriver();
diff --git a/flutter_document_scanner/example/web/favicon.png b/flutter_document_scanner/example/web/favicon.png
new file mode 100644
index 0000000..8aaa46a
Binary files /dev/null and b/flutter_document_scanner/example/web/favicon.png differ
diff --git a/flutter_document_scanner/example/web/icons/Icon-192.png b/flutter_document_scanner/example/web/icons/Icon-192.png
new file mode 100644
index 0000000..b749bfe
Binary files /dev/null and b/flutter_document_scanner/example/web/icons/Icon-192.png differ
diff --git a/flutter_document_scanner/example/web/icons/Icon-512.png b/flutter_document_scanner/example/web/icons/Icon-512.png
new file mode 100644
index 0000000..88cfd48
Binary files /dev/null and b/flutter_document_scanner/example/web/icons/Icon-512.png differ
diff --git a/flutter_document_scanner/example/web/icons/Icon-maskable-192.png b/flutter_document_scanner/example/web/icons/Icon-maskable-192.png
new file mode 100644
index 0000000..eb9b4d7
Binary files /dev/null and b/flutter_document_scanner/example/web/icons/Icon-maskable-192.png differ
diff --git a/flutter_document_scanner/example/web/icons/Icon-maskable-512.png b/flutter_document_scanner/example/web/icons/Icon-maskable-512.png
new file mode 100644
index 0000000..d69c566
Binary files /dev/null and b/flutter_document_scanner/example/web/icons/Icon-maskable-512.png differ
diff --git a/flutter_document_scanner/example/web/index.html b/flutter_document_scanner/example/web/index.html
new file mode 100644
index 0000000..b6b9dd2
--- /dev/null
+++ b/flutter_document_scanner/example/web/index.html
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+
+
diff --git a/flutter_document_scanner/example/web/manifest.json b/flutter_document_scanner/example/web/manifest.json
new file mode 100644
index 0000000..096edf8
--- /dev/null
+++ b/flutter_document_scanner/example/web/manifest.json
@@ -0,0 +1,35 @@
+{
+ "name": "example",
+ "short_name": "example",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-maskable-192.png",
+ "sizes": "192x192",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "icons/Icon-maskable-512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "maskable"
+ }
+ ]
+}
diff --git a/flutter_document_scanner/lib/flutter_document_scanner.dart b/flutter_document_scanner/lib/flutter_document_scanner.dart
new file mode 100644
index 0000000..ab76edc
--- /dev/null
+++ b/flutter_document_scanner/lib/flutter_document_scanner.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+library flutter_document_scanner;
+
+export 'package:camera/camera.dart';
+export 'package:flutter_document_scanner_platform_interface/flutter_document_scanner_platform_interface.dart';
+
+export 'src/bloc/app/app_state.dart';
+export 'src/document_scanner_controller.dart';
+export 'src/models/area.dart';
+export 'src/ui/pages/document_scanner.dart';
+export 'src/utils/crop_photo_document_style.dart';
+export 'src/utils/edit_photo_document_style.dart';
+export 'src/utils/general_styles.dart';
+export 'src/utils/take_photo_document_style.dart';
diff --git a/flutter_document_scanner/lib/src/bloc/app/app.dart b/flutter_document_scanner/lib/src/bloc/app/app.dart
new file mode 100644
index 0000000..1417f49
--- /dev/null
+++ b/flutter_document_scanner/lib/src/bloc/app/app.dart
@@ -0,0 +1,3 @@
+export 'app_bloc.dart';
+export 'app_event.dart';
+export 'app_state.dart';
diff --git a/flutter_document_scanner/lib/src/bloc/app/app_bloc.dart b/flutter_document_scanner/lib/src/bloc/app/app_bloc.dart
new file mode 100644
index 0000000..1d0398f
--- /dev/null
+++ b/flutter_document_scanner/lib/src/bloc/app/app_bloc.dart
@@ -0,0 +1,252 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:bloc/bloc.dart';
+import 'package:camera/camera.dart';
+import 'package:flutter_document_scanner/src/bloc/app/app.dart';
+import 'package:flutter_document_scanner/src/bloc/crop/crop.dart';
+import 'package:flutter_document_scanner/src/bloc/edit/edit.dart';
+import 'package:flutter_document_scanner/src/document_scanner_controller.dart';
+import 'package:flutter_document_scanner/src/utils/image_utils.dart';
+import 'package:flutter_document_scanner_platform_interface/flutter_document_scanner_platform_interface.dart';
+
+/// Controls interactions throughout the application by means
+/// of the [DocumentScannerController]
+class AppBloc extends Bloc {
+ /// Create instance AppBloc
+ AppBloc({
+ required ImageUtils imageUtils,
+ }) : _imageUtils = imageUtils,
+ super(AppState.init()) {
+ on(_cameraInitialized);
+ on(_photoTaken);
+ on(_pageChanged);
+ on(_photoCropped);
+ on(_loadCroppedPhoto);
+ on(_filterApplied);
+ on(_newEditedImageLoaded);
+ on(_startedSavingDocument);
+ on(_documentSaved);
+ }
+
+ final ImageUtils _imageUtils;
+
+ CameraController? _cameraController;
+ late XFile? _pictureTaken;
+
+ /// Initialize [CameraController]
+ /// based on the parameters sent by [AppCameraInitialized]
+ ///
+ /// [AppCameraInitialized.cameraLensDirection] for [CameraLensDirection]
+ /// [AppCameraInitialized.resolutionCamera] for the [ResolutionPreset] camera
+ Future _cameraInitialized(
+ AppCameraInitialized event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusCamera: AppStatus.loading,
+ ),
+ );
+
+ final cameras = await availableCameras();
+ final camera = cameras.firstWhere(
+ (camera) => camera.lensDirection == event.cameraLensDirection,
+ orElse: () => cameras.first,
+ );
+
+ _cameraController = CameraController(
+ camera,
+ event.resolutionCamera,
+ enableAudio: false,
+ );
+
+ await _cameraController!.initialize();
+
+ emit(
+ state.copyWith(
+ statusCamera: AppStatus.success,
+ cameraController: _cameraController,
+ ),
+ );
+ }
+
+ /// Take a photo with the [CameraController.takePicture]
+ ///
+ /// Then [ImageUtils.findContourPhoto] with the largest area by
+ /// [AppPhotoTaken.minContourArea] in the image
+ Future _photoTaken(
+ AppPhotoTaken event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusTakePhotoPage: AppStatus.loading,
+ ),
+ );
+
+ if (_cameraController == null) {
+ // TODO(bloc): add validation and error handling
+ return;
+ }
+
+ _pictureTaken = await _cameraController!.takePicture();
+
+ final byteData = await _pictureTaken!.readAsBytes();
+ final response = await _imageUtils.findContourPhoto(
+ byteData,
+ minContourArea: event.minContourArea,
+ );
+
+ final fileImage = File(_pictureTaken!.path);
+
+ emit(
+ state.copyWith(
+ statusTakePhotoPage: AppStatus.success,
+ pictureInitial: fileImage,
+ contourInitial: response,
+ ),
+ );
+
+ emit(
+ state.copyWith(
+ currentPage: AppPages.cropPhoto,
+ ),
+ );
+ }
+
+ /// When changing the page, the state will be initialized.
+ Future _pageChanged(
+ AppPageChanged event,
+ Emitter emit,
+ ) async {
+ switch (event.newPage) {
+ case AppPages.takePhoto:
+ emit(
+ state.copyWith(
+ currentPage: event.newPage,
+ statusTakePhotoPage: AppStatus.initial,
+ statusCropPhoto: AppStatus.initial,
+ contourInitial: null,
+ ),
+ );
+ break;
+
+ case AppPages.cropPhoto:
+ emit(
+ state.copyWith(
+ currentPage: event.newPage,
+ currentFilterType: FilterType.natural,
+ ),
+ );
+ break;
+
+ case AppPages.editDocument:
+ emit(
+ state.copyWith(
+ currentPage: event.newPage,
+ statusEditPhoto: AppStatus.initial,
+ statusSavePhotoDocument: AppStatus.initial,
+ ),
+ );
+ break;
+ }
+ }
+
+ /// It will change the state and
+ /// execute the event [CropPhotoByAreaCropped] to crop the image that is in
+ /// the [CropBloc].
+ Future _photoCropped(
+ AppPhotoCropped event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusCropPhoto: AppStatus.loading,
+ ),
+ );
+ }
+
+ /// It will change the state and then change page to [AppPages.editDocument]
+ Future _loadCroppedPhoto(
+ AppLoadCroppedPhoto event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusCropPhoto: AppStatus.success,
+ pictureCropped: event.image,
+ contourInitial: event.area,
+ ),
+ );
+
+ emit(
+ state.copyWith(
+ currentPage: AppPages.editDocument,
+ ),
+ );
+ }
+
+ /// It will change the state and
+ /// execute the event [EditFilterChanged] to crop the image that is
+ /// in the [EditBloc].
+ Future _filterApplied(
+ AppFilterApplied event,
+ Emitter emit,
+ ) async {
+ if (event.filter == state.currentFilterType) return;
+
+ emit(
+ state.copyWith(
+ currentFilterType: event.filter,
+ statusEditPhoto: AppStatus.loading,
+ ),
+ );
+ }
+
+ /// It is called when the image filter changes
+ Future _newEditedImageLoaded(
+ AppNewEditedImageLoaded event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusEditPhoto:
+ event.isSuccess ? AppStatus.success : AppStatus.failure,
+ ),
+ );
+ }
+
+ /// It will change the state and
+ /// validate if image edited is valid.
+ Future _startedSavingDocument(
+ AppStartedSavingDocument event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusSavePhotoDocument: AppStatus.loading,
+ ),
+ );
+ }
+
+ /// Change state after saved the document
+ Future _documentSaved(
+ AppDocumentSaved event,
+ Emitter emit,
+ ) async {
+ emit(
+ state.copyWith(
+ statusSavePhotoDocument:
+ event.isSuccess ? AppStatus.success : AppStatus.failure,
+ ),
+ );
+ }
+}
diff --git a/lib/src/bloc/app/app_event.dart b/flutter_document_scanner/lib/src/bloc/app/app_event.dart
similarity index 60%
rename from lib/src/bloc/app/app_event.dart
rename to flutter_document_scanner/lib/src/bloc/app/app_event.dart
index df78825..391c54e 100644
--- a/lib/src/bloc/app/app_event.dart
+++ b/flutter_document_scanner/lib/src/bloc/app/app_event.dart
@@ -1,22 +1,35 @@
+// Copyright (c) 2021, Christian Betancourt
+// https://github.com/criistian14
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
import 'dart:typed_data';
import 'package:camera/camera.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_document_scanner/src/bloc/app/app_state.dart';
import 'package:flutter_document_scanner/src/models/area.dart';
-import 'package:flutter_document_scanner/src/models/filter_type.dart';
+import 'package:flutter_document_scanner_platform_interface/flutter_document_scanner_platform_interface.dart';
+/// Class to create events
abstract class AppEvent extends Equatable {}
+/// Event to initialize the app
class AppCameraInitialized extends AppEvent {
- final CameraLensDirection cameraLensDirection;
- final ResolutionPreset resolutionCamera;
-
+ /// Create an event instance
AppCameraInitialized({
required this.cameraLensDirection,
required this.resolutionCamera,
});
+ /// Camera library [CameraLensDirection]
+ final CameraLensDirection cameraLensDirection;
+
+ /// Camera library [ResolutionPreset]
+ final ResolutionPreset resolutionCamera;
+
@override
List