Ver código fonte

Fixed scan area not honored

flutter-beta
Julian Steenbakker 5 anos atrás
pai
commit
2a98955040
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: 16E437C7A3D94250
2 arquivos alterados com 17 adições e 7 exclusões
  1. +4
    -6
      example/ios/Runner.xcodeproj/project.pbxproj
  2. +13
    -1
      ios/Classes/QRView.swift

+ 4
- 6
example/ios/Runner.xcodeproj/project.pbxproj Ver arquivo

@@ -168,7 +168,7 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = RCH2VG82SH;
DevelopmentTeam = 5LSCTACHT8;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
@@ -250,13 +250,11 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework",
"${BUILT_PRODUCTS_DIR}/qr_code_scanner/qr_code_scanner.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MTBBarcodeScanner.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/qr_code_scanner.framework",
);
@@ -372,7 +370,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = RCH2VG82SH;
DEVELOPMENT_TEAM = 5LSCTACHT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -510,7 +508,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = RCH2VG82SH;
DEVELOPMENT_TEAM = 5LSCTACHT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -541,7 +539,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = RCH2VG82SH;
DEVELOPMENT_TEAM = 5LSCTACHT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",


+ 13
- 1
ios/Classes/QRView.swift Ver arquivo

@@ -72,14 +72,23 @@ public class QRView:NSObject,FlutterPlatformView {
}
func setDimensions(width: Double, height: Double, scanArea: Double) -> Void {
// First set the size of the preview area.
previewView.frame = CGRect(x: 0, y: 0, width: width, height: height)
// Then set the size of the scan area.
let midX = self.view().bounds.midX
let midY = self.view().bounds.midY
// Check if the scanner is already created.
if let sc: MTBBarcodeScanner = scanner {
if let previewLayer = sc.previewLayer {
previewLayer.frame = previewView.bounds;
}
if (scanArea != 0) {
sc.scanRect = CGRect(x: Double(midX) - (scanArea / 2), y: Double(midY) - (scanArea / 2), width: scanArea, height: scanArea)
}
} else {
// Create a scanner view if it doesn't exist yet.
scanner = MTBBarcodeScanner(previewView: previewView)
if (scanArea != 0) {
@@ -91,7 +100,10 @@ public class QRView:NSObject,FlutterPlatformView {
}
func startScan(_ arguments: Array<Int>, _ result: @escaping FlutterResult) -> Void {
scanner = MTBBarcodeScanner(previewView: previewView)
if (scanner == nil) {
scanner = MTBBarcodeScanner(previewView: previewView)
}
var allowedBarcodeTypes: Array<AVMetadataObject.ObjectType> = []
arguments.forEach { arg in


Carregando…
Cancelar
Salvar