-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Shared common scanner (#3883)
* First movement * devcotainer * Lint fixes * Shared visor * Final moves * Final lint fixes * Empty widget, moved scan header * Update scanner_ml_kit.dart --------- Co-authored-by: Marvin Moeltgen
- Loading branch information
Showing
42 changed files
with
623 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
.packages | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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. | ||
|
||
version: | ||
revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
channel: stable | ||
|
||
project_type: plugin | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
- platform: android | ||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Shared rules | ||
include: package:openfoodfacts_flutter_lints/flutter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
library app_store_uri; | ||
|
||
export 'src/scanner_ml_kit.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: scanner_ml_kit | ||
description: Scanner implementation using ML Kit | ||
version: 1.0.0 | ||
publish_to: "none" | ||
|
||
environment: | ||
sdk: ">=2.19.0 <3.0.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
visibility_detector: 0.4.0+2 | ||
mobile_scanner: 3.2.0 | ||
scanner_shared: | ||
path: ../shared | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
flutter_lints: 2.0.1 | ||
openfoodfacts_flutter_lints: | ||
git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
// The CI needs at least one test | ||
void main() { | ||
testWidgets('Fake test', (WidgetTester tester) async { | ||
expect(true, true); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# 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 | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
.packages | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 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: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
channel: stable | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Shared rules | ||
include: package:openfoodfacts_flutter_lints/flutter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
library app_store_shared; | ||
|
||
export 'src/scanner.dart'; | ||
export 'src/scanner_mocked.dart'; | ||
export 'src/scanner_visor.dart'; | ||
export 'src/utils.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Base class for the Scanner interface… | ||
abstract class Scanner { | ||
const Scanner(); | ||
|
||
static const String ANALYTICS_CATEGORY = 'scanning'; | ||
static const String ANALYTICS_STRANGE_RESTART = 'strange restart'; | ||
static const String ANALYTICS_STRANGE_RESTOP = 'strange restop'; | ||
|
||
String getType(); | ||
|
||
Widget getScanner({ | ||
required Future<bool> Function(String) onScan, | ||
required Future<void> Function() hapticFeedback, | ||
required Function(BuildContext)? onCameraFlashError, | ||
required Function(String msg, String category, | ||
{int? eventValue, String? barcode}) | ||
trackCustomEvent, | ||
required bool hasMoreThanOneCamera, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:scanner_shared/scanner_shared.dart'; | ||
|
||
/// Empty implementation for an [AppStore] | ||
class MockedScanner extends Scanner { | ||
const MockedScanner(); | ||
|
||
@override | ||
String getType() => 'Mocked'; | ||
|
||
@override | ||
Widget getScanner({ | ||
required Future<bool> Function(String) onScan, | ||
required Future<void> Function() hapticFeedback, | ||
required Function(BuildContext)? onCameraFlashError, | ||
required Function(String msg, String category, | ||
{int? eventValue, String? barcode}) | ||
trackCustomEvent, | ||
required bool hasMoreThanOneCamera, | ||
}) => | ||
Container(); | ||
} |
Oops, something went wrong.