Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e5d99d9
DS 8.0: Updated the project to use a new SDK structure
OleksiiScanbot Nov 26, 2025
ed1848d
DS 8.0: Updated java/kotlin versions and some calls
OleksiiScanbot Dec 4, 2025
8ca07e6
DS 8.0: Format code
OleksiiScanbot Dec 4, 2025
8e95c45
DS 8.0: Updated calls using result pattern
OleksiiScanbot Jan 12, 2026
b51daa3
DS 8.0: Updated imports and min flutter version
OleksiiScanbot Jan 26, 2026
6fbed63
DS 8.0: Updated menu titles
OleksiiScanbot Jan 27, 2026
d3bfbbe
DS 8.0: Removed legacy page repo, updated custom ui pages
OleksiiScanbot Feb 3, 2026
9d83ec4
DS 8.0: Updated manifest
OleksiiScanbot Feb 3, 2026
82e954f
DS 8.0: Updated license error handling
OleksiiScanbot Feb 3, 2026
bd61803
DS 8.0: Updated snippets
OleksiiScanbot Feb 5, 2026
544dfe9
DS 8.0: Renamed camera controller
OleksiiScanbot Feb 5, 2026
7c7cdec
DS 8.0: Updated custom UI example
OleksiiScanbot Feb 9, 2026
31c4a5e
DS 8.0: Added image refs snippets
OleksiiScanbot Feb 9, 2026
69d2413
DS 8.0: Updated results handling
OleksiiScanbot Feb 9, 2026
f8831b2
Updated year
OleksiiScanbot Feb 9, 2026
d8922aa
DS 8.0: Updated cropping example and formatted code
OleksiiScanbot Feb 10, 2026
a6b2271
DS 8.0: Removed unused widget
OleksiiScanbot Feb 10, 2026
9313263
DS 8.0: Format fix
OleksiiScanbot Feb 10, 2026
4d4bb74
DS 8.0: Added scanDocumentFromImageRef snippet
OleksiiScanbot Feb 12, 2026
689e54a
DS 8.0: Updated libraries.txt
OleksiiScanbot Feb 17, 2026
0923cb3
DS 8.0: Minor fixes
OleksiiScanbot Feb 17, 2026
ed0278d
DS 8.0: Removed unnecessary autorelease blocks
OleksiiScanbot Feb 17, 2026
dec19ab
DS 8.0: Added snippets
OleksiiScanbot Feb 19, 2026
6f1349d
DS 8.0: Added snippets
OleksiiScanbot Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
566 changes: 451 additions & 115 deletions Libraries.txt

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ Through this feature, our SDK offers document detection and data capture capabil

## Additional information

### Free integration support

Need help integrating or testing our Document Scanner SDK? We offer [free developer support](https://docs.scanbot.io/support/?utm_source=github.com&utm_medium=referral&utm_campaign=dev_sites) via Slack, MS Teams, or email.

As a customer, you also get access to a dedicated support Slack or Microsoft Teams channel to talk directly to your Customer Success Manager and our engineers.

### Trial license and pricing

The Scanbot SDK examples will run for one minute per session without a license. After that, all functionalities and UI components will stop working.
Expand Down
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ plugins {

android {
namespace = "com.example.scanbot_sdk_example_flutter"
compileSdk = 35
compileSdk = 36

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
jvmTarget = JavaVersion.VERSION_21
}

defaultConfig {
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>

<!-- required for mock camera functionality to allow full access to external storage.-->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri May 10 16:38:24 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.2" apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
id "com.android.application" version "8.10.1" apply false
id "org.jetbrains.kotlin.android" version "2.1.21" apply false
}

include ":app"
105 changes: 50 additions & 55 deletions lib/classic_components/cropping_custom_ui.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart' as sdk;
import '../storage/_legacy_pages_repository.dart';
import '../utility/utils.dart';

/// This screen demonstrates how to integrate the classical cropping component
class CroppingScreenWidget extends StatefulWidget {
const CroppingScreenWidget({Key? key, required this.page}) : super(key: key);
final sdk.Page page;
const CroppingScreenWidget({Key? key, required this.documentImage})
: super(key: key);
final ImageRef documentImage;

@override
_CroppingScreenWidgetState createState() => _CroppingScreenWidgetState();
}

class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
final LegacyPageRepository _pageRepository = LegacyPageRepository();
late sdk.Page currentPage;
late ImageRef currentPage;
bool showProgressBar = false;
bool doneButtonEnabled = true;
CroppingController? croppingController;

@override
void initState() {
super.initState();
currentPage = widget.page;
currentPage = widget.documentImage;
}

@override
Expand All @@ -36,36 +37,13 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
if (showProgressBar) _buildProgressBar(),
],
),
floatingActionButton: _buildFloatingActionButton(),
bottomNavigationBar: _buildBottomAppBar(),
);
}

Widget _buildFloatingActionButton() {
return FloatingActionButton(
onPressed: _handleNextPage,
child: const Icon(Icons.navigate_next),
);
}

Future<void> _handleNextPage() async {
setState(() {
showProgressBar = true;
});

final nextPage = await _pageRepository.nextPage(currentPage);

setState(() {
showProgressBar = false;
currentPage = nextPage;
});
}

AppBar _buildAppBar() {
return AppBar(
iconTheme: const IconThemeData(
color: Colors.white,
),
iconTheme: const IconThemeData(color: Colors.white),
backgroundColor: ScanbotRedColor,
title: const Text(
'Crop document',
Expand All @@ -82,17 +60,14 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
),
actions: [
if (doneButtonEnabled)
IconButton(
icon: const Icon(Icons.done),
onPressed: cropAndPop,
),
IconButton(icon: const Icon(Icons.done), onPressed: cropAndPop),
],
);
}

Widget _buildCroppingWidget() {
return ScanbotCroppingWidget(
page: currentPage,
documentImage: currentPage,
onViewReady: (controller) {
croppingController = controller;
},
Expand All @@ -101,10 +76,13 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
showProgressBar = isProcessing;
});
},
onError: (error) {
Logger.root.severe(error.toString());
},
edgeColor: Colors.red,
edgeColorOnLine: Colors.blue,
anchorPointsColor: Colors.amberAccent,
borderInsets: sdk.Insets.all(16),
borderInsets: Insets.all(16),
);
}

Expand All @@ -125,7 +103,7 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
children: [
_buildBottomBarButton('Reset', () => croppingController?.reset()),
_buildBottomBarButton('Detect', () => croppingController?.detect()),
_buildBottomBarButton('Rotate Cw', _rotateImage),
_buildBottomBarButton('Rotate \u21BB', _rotateImage),
],
),
);
Expand All @@ -134,10 +112,7 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
Widget _buildBottomBarButton(String label, VoidCallback onPressed) {
return TextButton(
onPressed: doneButtonEnabled ? onPressed : null,
child: Text(
label,
style: const TextStyle(color: Colors.black),
),
child: Text(label, style: const TextStyle(color: Colors.black)),
);
}

Expand All @@ -155,15 +130,6 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
});
}

Future<sdk.Page> proceedImage(
sdk.Page page, CroppingPolygon croppingResult) async {
return await ScanbotSdk.cropAndRotatePage(
page,
croppingResult.polygon,
croppingResult.rotationTimesCw,
);
}

Future<void> cropAndPop() async {
setState(() {
showProgressBar = true;
Expand All @@ -175,9 +141,38 @@ class _CroppingScreenWidgetState extends State<CroppingScreenWidget> {
showProgressBar = false;
});

if (croppingResult != null) {
var newPage = await proceedImage(currentPage, croppingResult);
Navigator.of(context).pop(newPage);
if (croppingResult == null) {
Navigator.of(context).pop();
return;
}

final documentResult = await ScanbotSdk.document
.createDocumentFromImageRefs(images: [currentPage]);

if (documentResult is! Ok<DocumentData>) {
print(documentResult.toString());
return;
}

final document = documentResult.value;

final modifiedDocumentResult = await ScanbotSdk.document.modifyPage(
document.uuid,
document.pages.first.uuid,
options: ModifyPageOptions(
rotation: ImageRotation.values[croppingResult.rotationTimesCw],
polygon: toPointList(croppingResult.polygon),
),
);

if (modifiedDocumentResult is! Ok<DocumentData>) {
print(modifiedDocumentResult.toString());
return;
}

Navigator.of(context).pop(modifiedDocumentResult.value);
}
}
}

List<Point<double>> toPointList(List<PolygonPoint> polygon) =>
polygon.map((p) => Point<double>(p.x, p.y)).toList();
64 changes: 0 additions & 64 deletions lib/classic_components/custom_ui_menu.dart

This file was deleted.

Loading