Skip to content

update to v7.0 pre-alpha #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ios/Flutter/Flutter.podspec
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/app/.cxx
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.example.scanbot_sdk_example_flutter"
compileSdk = flutter.compileSdkVersion
compileSdk = 35

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand Down
6 changes: 6 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<!-- If you are targeting Android 13 (API level 33) or higher, add the following permission -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand Down
11 changes: 10 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = FRUPYT6KB3;
LastSwiftMigration = 0910;
};
};
Expand Down Expand Up @@ -260,6 +259,11 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework",
"${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
"${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework",
"${BUILT_PRODUCTS_DIR}/image_picker_ios/image_picker_ios.framework",
"${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework",
"${BUILT_PRODUCTS_DIR}/scanbot_sdk/scanbot_sdk.framework",
Expand All @@ -270,6 +274,11 @@
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKImagePickerController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKPhotoGallery.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/scanbot_sdk.framework",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
75 changes: 0 additions & 75 deletions lib/barcode/_legacy_barcode_use_cases.dart

This file was deleted.

70 changes: 49 additions & 21 deletions lib/barcode/barcode_sdk_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import 'package:image_picker/image_picker.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';

import '../ui/menu_item_widget.dart';
import '../ui/preview/barcode_multi_images_preview.dart';
import '../ui/preview/_legacy_barcode_preview.dart';
import '../ui/preview/barcodes_result_preview.dart';
import '../utility/utils.dart';

import 'barcode_use_cases.dart';
import '_legacy_barcode_use_cases.dart';

class BarcodeSdkMenu extends StatelessWidget {
const BarcodeSdkMenu({Key? key}) : super(key: key);
Expand All @@ -21,10 +19,9 @@ class BarcodeSdkMenu extends StatelessWidget {
body: ListView(
children: <Widget>[
const BarcodeUseCasesWidget(),
const BarcodeLegacyUseCasesWidget(),
const TitleItemWidget(title: 'Other API'),
BuildMenuItem(context, 'Detect Barcodes from Still Image', _detectBarcodeOnImage),
BuildMenuItem(context, 'Detect Barcodes from Multiple Still Images', _detectBarcodesOnImages),
MenuItemWidget(title: 'Detect Barcodes from Still Image', onTap: () => _detectBarcodeOnImage(context)),
MenuItemWidget(title: 'Detect Barcodes from Multiple Still Images', onTap: () => _detectBarcodesOnImages(context)),
],
),
);
Expand All @@ -39,20 +36,26 @@ class BarcodeSdkMenu extends StatelessWidget {
final response = await selectImageFromLibrary();

if (response == null || response.path.isEmpty) {
showAlertDialog(context, "RESULT IS EMPTY");
await showAlertDialog(context, title: "Info", "No image picked.");
return;
}

final uriPath = Uri.file(response.path);

var result = await ScanbotSdk.detectBarcodesOnImage(uriPath,
barcodeFormats: PredefinedBarcodes.allBarcodeTypes());
if (result.operationResult == OperationResult.SUCCESS) {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BarcodesResultPreviewWidget(result)),
);
var result = await ScanbotSdk.detectBarcodesOnImage(
uriPath,
BarcodeScannerConfiguration());

if(!result.success) {
await showAlertDialog(context, title: "Info", "No barcodes detected.");
return;
}

await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BarcodesResultPreviewWidget(result.barcodes)),
);

} catch (ex) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(ex.toString()),
Expand All @@ -71,20 +74,45 @@ class BarcodeSdkMenu extends StatelessWidget {

final response = await ImagePicker().pickMultiImage();
if (response.isEmpty) {
showAlertDialog(context, "RESULT IS EMPTY");
await showAlertDialog(context, title: "Info", "No image picked.");
return;
}

showDialog(
context: context,
builder: (context) {
return const Center(child: CircularProgressIndicator());
}
);

uris = response.map((image) => Uri.file(image.path)).toList();

var result = await ScanbotSdk.detectBarcodesOnImages(uris,
barcodeFormats: PredefinedBarcodes.allBarcodeTypes());
if (result.operationResult == OperationResult.SUCCESS) {
await Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
MultiImageBarcodesResultPreviewWidget(result.barcodeResults)));
List<BarcodeItem> allBarcodes = [];

for (var uri in uris) {
var result = await ScanbotSdk.detectBarcodesOnImage(
uri,
BarcodeScannerConfiguration());

allBarcodes.addAll(result.barcodes);
}

Navigator.of(context).pop();

if (allBarcodes.isNotEmpty) {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BarcodesResultPreviewWidget(allBarcodes),
),
);
} else {
await showAlertDialog(context, title: "Info", "No barcodes detected.");
return;
}

} catch (ex) {
Navigator.of(context, rootNavigator: true).pop();

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(ex.toString()),
));
Expand Down
Loading