Committed by
GitHub
Merge pull request #813 from navaronbracke/reorganise_classes
feat: Reorganise enums
Showing
17 changed files
with
355 additions
and
286 deletions
| 1 | +export 'src/enums/address_type.dart'; | ||
| 2 | +export 'src/enums/barcode_format.dart'; | ||
| 3 | +export 'src/enums/barcode_type.dart'; | ||
| 1 | export 'src/enums/camera_facing.dart'; | 4 | export 'src/enums/camera_facing.dart'; |
| 2 | export 'src/enums/detection_speed.dart'; | 5 | export 'src/enums/detection_speed.dart'; |
| 6 | +export 'src/enums/email_type.dart'; | ||
| 7 | +export 'src/enums/encryption_type.dart'; | ||
| 3 | export 'src/enums/mobile_scanner_error_code.dart'; | 8 | export 'src/enums/mobile_scanner_error_code.dart'; |
| 4 | export 'src/enums/mobile_scanner_state.dart'; | 9 | export 'src/enums/mobile_scanner_state.dart'; |
| 5 | -export 'src/enums/ratio.dart'; | 10 | +export 'src/enums/phone_type.dart'; |
| 6 | export 'src/enums/torch_state.dart'; | 11 | export 'src/enums/torch_state.dart'; |
| 7 | export 'src/mobile_scanner.dart'; | 12 | export 'src/mobile_scanner.dart'; |
| 8 | export 'src/mobile_scanner_controller.dart'; | 13 | export 'src/mobile_scanner_controller.dart'; |
| @@ -6,8 +6,8 @@ import 'package:flutter/services.dart'; | @@ -6,8 +6,8 @@ import 'package:flutter/services.dart'; | ||
| 6 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; | 6 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; |
| 7 | import 'package:mobile_scanner/mobile_scanner_web.dart'; | 7 | import 'package:mobile_scanner/mobile_scanner_web.dart'; |
| 8 | import 'package:mobile_scanner/src/barcode_utility.dart'; | 8 | import 'package:mobile_scanner/src/barcode_utility.dart'; |
| 9 | +import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 9 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; | 10 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; |
| 10 | -import 'package:mobile_scanner/src/objects/barcode.dart'; | ||
| 11 | 11 | ||
| 12 | /// This plugin is the web implementation of mobile_scanner. | 12 | /// This plugin is the web implementation of mobile_scanner. |
| 13 | /// It only supports QR codes. | 13 | /// It only supports QR codes. |
lib/src/enums/address_type.dart
0 → 100644
| 1 | +/// Address type constants. | ||
| 2 | +enum AddressType { | ||
| 3 | + /// Unknown address type. | ||
| 4 | + unknown(0), | ||
| 5 | + | ||
| 6 | + /// Work address. | ||
| 7 | + work(1), | ||
| 8 | + | ||
| 9 | + /// Home address. | ||
| 10 | + home(2); | ||
| 11 | + | ||
| 12 | + const AddressType(this.rawValue); | ||
| 13 | + | ||
| 14 | + factory AddressType.fromRawValue(int value) { | ||
| 15 | + switch (value) { | ||
| 16 | + case 1: | ||
| 17 | + return AddressType.work; | ||
| 18 | + case 2: | ||
| 19 | + return AddressType.home; | ||
| 20 | + case 0: | ||
| 21 | + default: | ||
| 22 | + return AddressType.unknown; | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /// The raw address type value. | ||
| 27 | + final int rawValue; | ||
| 28 | +} |
lib/src/enums/barcode_format.dart
0 → 100644
| 1 | +/// This enum defines the different barcode formats. | ||
| 2 | +enum BarcodeFormat { | ||
| 3 | + /// A barcode format that represents all unknown formats. | ||
| 4 | + unknown(-1), | ||
| 5 | + | ||
| 6 | + /// A barcode format that represents all known formats. | ||
| 7 | + all(0), | ||
| 8 | + | ||
| 9 | + /// Barcode format constant for Code 128. | ||
| 10 | + code128(1), | ||
| 11 | + | ||
| 12 | + /// Barcode format constant for Code 39. | ||
| 13 | + code39(2), | ||
| 14 | + | ||
| 15 | + /// Barcode format constant for Code 93. | ||
| 16 | + code93(4), | ||
| 17 | + | ||
| 18 | + /// Barcode format constant for Codabar. | ||
| 19 | + codebar(8), | ||
| 20 | + | ||
| 21 | + /// Barcode format constant for Data Matrix. | ||
| 22 | + dataMatrix(16), | ||
| 23 | + | ||
| 24 | + /// Barcode format constant for EAN-13. | ||
| 25 | + ean13(32), | ||
| 26 | + | ||
| 27 | + /// Barcode format constant for EAN-8. | ||
| 28 | + ean8(64), | ||
| 29 | + | ||
| 30 | + /// Barcode format constant for ITF (Interleaved Two-of-Five). | ||
| 31 | + itf(128), | ||
| 32 | + | ||
| 33 | + /// Barcode format constant for QR Codes. | ||
| 34 | + qrCode(256), | ||
| 35 | + | ||
| 36 | + /// Barcode format constant for UPC-A. | ||
| 37 | + upcA(512), | ||
| 38 | + | ||
| 39 | + /// Barcode format constant for UPC-E. | ||
| 40 | + upcE(1024), | ||
| 41 | + | ||
| 42 | + /// Barcode format constant for PDF-417. | ||
| 43 | + pdf417(2048), | ||
| 44 | + | ||
| 45 | + /// Barcode format constant for AZTEC. | ||
| 46 | + aztec(4096); | ||
| 47 | + | ||
| 48 | + const BarcodeFormat(this.rawValue); | ||
| 49 | + | ||
| 50 | + factory BarcodeFormat.fromRawValue(int value) { | ||
| 51 | + switch (value) { | ||
| 52 | + case 0: | ||
| 53 | + return BarcodeFormat.all; | ||
| 54 | + case 1: | ||
| 55 | + return BarcodeFormat.code128; | ||
| 56 | + case 2: | ||
| 57 | + return BarcodeFormat.code39; | ||
| 58 | + case 4: | ||
| 59 | + return BarcodeFormat.code93; | ||
| 60 | + case 8: | ||
| 61 | + return BarcodeFormat.codebar; | ||
| 62 | + case 16: | ||
| 63 | + return BarcodeFormat.dataMatrix; | ||
| 64 | + case 32: | ||
| 65 | + return BarcodeFormat.ean13; | ||
| 66 | + case 64: | ||
| 67 | + return BarcodeFormat.ean8; | ||
| 68 | + case 128: | ||
| 69 | + return BarcodeFormat.itf; | ||
| 70 | + case 256: | ||
| 71 | + return BarcodeFormat.qrCode; | ||
| 72 | + case 512: | ||
| 73 | + return BarcodeFormat.upcA; | ||
| 74 | + case 1024: | ||
| 75 | + return BarcodeFormat.upcE; | ||
| 76 | + case 2048: | ||
| 77 | + return BarcodeFormat.pdf417; | ||
| 78 | + case 4096: | ||
| 79 | + return BarcodeFormat.aztec; | ||
| 80 | + case -1: | ||
| 81 | + default: | ||
| 82 | + return BarcodeFormat.unknown; | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + /// The raw value of the barcode format. | ||
| 87 | + final int rawValue; | ||
| 88 | +} |
lib/src/enums/barcode_type.dart
0 → 100644
| 1 | +/// Barcode value type constants. | ||
| 2 | +enum BarcodeType { | ||
| 3 | + /// An unknown barcode type. | ||
| 4 | + unknown(0), | ||
| 5 | + | ||
| 6 | + /// Barcode value type constant for contact information. | ||
| 7 | + contactInfo(1), | ||
| 8 | + | ||
| 9 | + /// Barcode value type constant for email message details. | ||
| 10 | + email(2), | ||
| 11 | + | ||
| 12 | + /// Barcode value type constant for ISBNs. | ||
| 13 | + isbn(3), | ||
| 14 | + | ||
| 15 | + /// Barcode value type constant for phone numbers. | ||
| 16 | + phone(4), | ||
| 17 | + | ||
| 18 | + /// Barcode value type constant for product codes. | ||
| 19 | + product(5), | ||
| 20 | + | ||
| 21 | + /// Barcode value type constant for SMS details. | ||
| 22 | + sms(6), | ||
| 23 | + | ||
| 24 | + /// Barcode value type constant for plain text. | ||
| 25 | + text(7), | ||
| 26 | + | ||
| 27 | + /// Barcode value type constant for URLs or bookmarks. | ||
| 28 | + url(8), | ||
| 29 | + | ||
| 30 | + /// Barcode value type constant for WiFi access point details. | ||
| 31 | + wifi(9), | ||
| 32 | + | ||
| 33 | + /// Barcode value type constant for geographic coordinates. | ||
| 34 | + geo(10), | ||
| 35 | + | ||
| 36 | + /// Barcode value type constant for calendar events. | ||
| 37 | + calendarEvent(11), | ||
| 38 | + | ||
| 39 | + /// Barcode value type constant for driver license data. | ||
| 40 | + driverLicense(12); | ||
| 41 | + | ||
| 42 | + const BarcodeType(this.rawValue); | ||
| 43 | + | ||
| 44 | + factory BarcodeType.fromRawValue(int value) { | ||
| 45 | + switch (value) { | ||
| 46 | + case 1: | ||
| 47 | + return BarcodeType.contactInfo; | ||
| 48 | + case 2: | ||
| 49 | + return BarcodeType.email; | ||
| 50 | + case 3: | ||
| 51 | + return BarcodeType.isbn; | ||
| 52 | + case 4: | ||
| 53 | + return BarcodeType.phone; | ||
| 54 | + case 5: | ||
| 55 | + return BarcodeType.product; | ||
| 56 | + case 6: | ||
| 57 | + return BarcodeType.sms; | ||
| 58 | + case 7: | ||
| 59 | + return BarcodeType.text; | ||
| 60 | + case 8: | ||
| 61 | + return BarcodeType.url; | ||
| 62 | + case 9: | ||
| 63 | + return BarcodeType.wifi; | ||
| 64 | + case 10: | ||
| 65 | + return BarcodeType.geo; | ||
| 66 | + case 11: | ||
| 67 | + return BarcodeType.calendarEvent; | ||
| 68 | + case 12: | ||
| 69 | + return BarcodeType.driverLicense; | ||
| 70 | + case 0: | ||
| 71 | + default: | ||
| 72 | + return BarcodeType.unknown; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /// The raw barcode type value. | ||
| 77 | + final int rawValue; | ||
| 78 | +} |
| 1 | /// The facing of a camera. | 1 | /// The facing of a camera. |
| 2 | enum CameraFacing { | 2 | enum CameraFacing { |
| 3 | /// Front facing camera. | 3 | /// Front facing camera. |
| 4 | - front, | 4 | + front(0), |
| 5 | 5 | ||
| 6 | /// Back facing camera. | 6 | /// Back facing camera. |
| 7 | - back, | 7 | + back(1); |
| 8 | + | ||
| 9 | + const CameraFacing(this.rawValue); | ||
| 10 | + | ||
| 11 | + /// The raw value for the camera facing direction. | ||
| 12 | + final int rawValue; | ||
| 8 | } | 13 | } |
| @@ -5,16 +5,21 @@ enum DetectionSpeed { | @@ -5,16 +5,21 @@ enum DetectionSpeed { | ||
| 5 | /// | 5 | /// |
| 6 | /// NOTE: This mode does analyze every frame in order to check if the value | 6 | /// NOTE: This mode does analyze every frame in order to check if the value |
| 7 | /// has changed. | 7 | /// has changed. |
| 8 | - noDuplicates, | 8 | + noDuplicates(0), |
| 9 | 9 | ||
| 10 | /// The barcode scanner will scan one barcode, and wait 250 Miliseconds before | 10 | /// The barcode scanner will scan one barcode, and wait 250 Miliseconds before |
| 11 | /// scanning again. This will prevent memory issues on older devices. | 11 | /// scanning again. This will prevent memory issues on older devices. |
| 12 | /// | 12 | /// |
| 13 | /// You can change the timeout duration with [detectionTimeout] parameter. | 13 | /// You can change the timeout duration with [detectionTimeout] parameter. |
| 14 | - normal, | 14 | + normal(1), |
| 15 | 15 | ||
| 16 | /// Let the scanner detect barcodes without restriction. | 16 | /// Let the scanner detect barcodes without restriction. |
| 17 | /// | 17 | /// |
| 18 | /// NOTE: This can cause memory issues with older devices. | 18 | /// NOTE: This can cause memory issues with older devices. |
| 19 | - unrestricted, | 19 | + unrestricted(2); |
| 20 | + | ||
| 21 | + const DetectionSpeed(this.rawValue); | ||
| 22 | + | ||
| 23 | + /// The raw value for the detection speed. | ||
| 24 | + final int rawValue; | ||
| 20 | } | 25 | } |
lib/src/enums/email_type.dart
0 → 100644
| 1 | +/// Email format type constants. | ||
| 2 | +enum EmailType { | ||
| 3 | + /// Unknown email type. | ||
| 4 | + unknown(0), | ||
| 5 | + | ||
| 6 | + /// Work email. | ||
| 7 | + work(1), | ||
| 8 | + | ||
| 9 | + /// Home email. | ||
| 10 | + home(2); | ||
| 11 | + | ||
| 12 | + const EmailType(this.rawValue); | ||
| 13 | + | ||
| 14 | + factory EmailType.fromRawValue(int value) { | ||
| 15 | + switch (value) { | ||
| 16 | + case 1: | ||
| 17 | + return EmailType.work; | ||
| 18 | + case 2: | ||
| 19 | + return EmailType.home; | ||
| 20 | + case 0: | ||
| 21 | + default: | ||
| 22 | + return EmailType.unknown; | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /// The raw email type value. | ||
| 27 | + final int rawValue; | ||
| 28 | +} |
lib/src/enums/encryption_type.dart
0 → 100644
| 1 | +/// Wifi encryption type constants. | ||
| 2 | +enum EncryptionType { | ||
| 3 | + /// Unknown encryption type. | ||
| 4 | + none(0), | ||
| 5 | + | ||
| 6 | + /// Not encrypted. | ||
| 7 | + open(1), | ||
| 8 | + | ||
| 9 | + /// WPA level encryption. | ||
| 10 | + wpa(2), | ||
| 11 | + | ||
| 12 | + /// WEP level encryption. | ||
| 13 | + wep(3); | ||
| 14 | + | ||
| 15 | + const EncryptionType(this.rawValue); | ||
| 16 | + | ||
| 17 | + factory EncryptionType.fromRawValue(int value) { | ||
| 18 | + switch (value) { | ||
| 19 | + case 1: | ||
| 20 | + return EncryptionType.open; | ||
| 21 | + case 2: | ||
| 22 | + return EncryptionType.wpa; | ||
| 23 | + case 3: | ||
| 24 | + return EncryptionType.wep; | ||
| 25 | + case 0: | ||
| 26 | + default: | ||
| 27 | + return EncryptionType.none; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /// The raw value for the encryption type. | ||
| 32 | + final int rawValue; | ||
| 33 | +} |
| 1 | /// The authorization state of the scanner. | 1 | /// The authorization state of the scanner. |
| 2 | enum MobileScannerState { | 2 | enum MobileScannerState { |
| 3 | /// The scanner has not yet requested the required permissions. | 3 | /// The scanner has not yet requested the required permissions. |
| 4 | - undetermined, | 4 | + undetermined(0), |
| 5 | 5 | ||
| 6 | /// The scanner has the required permissions. | 6 | /// The scanner has the required permissions. |
| 7 | - authorized, | 7 | + authorized(1), |
| 8 | 8 | ||
| 9 | /// The user denied the required permissions. | 9 | /// The user denied the required permissions. |
| 10 | - denied | 10 | + denied(2); |
| 11 | + | ||
| 12 | + const MobileScannerState(this.rawValue); | ||
| 13 | + | ||
| 14 | + factory MobileScannerState.fromRawValue(int value) { | ||
| 15 | + switch (value) { | ||
| 16 | + case 0: | ||
| 17 | + return MobileScannerState.undetermined; | ||
| 18 | + case 1: | ||
| 19 | + return MobileScannerState.authorized; | ||
| 20 | + case 2: | ||
| 21 | + return MobileScannerState.denied; | ||
| 22 | + default: | ||
| 23 | + throw ArgumentError.value(value, 'value', 'Invalid raw value.'); | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + /// The raw value for the state. | ||
| 28 | + final int rawValue; | ||
| 11 | } | 29 | } |
lib/src/enums/phone_type.dart
0 → 100644
| 1 | +/// Phone number format type constants. | ||
| 2 | +enum PhoneType { | ||
| 3 | + /// Unknown phone type. | ||
| 4 | + unknown(0), | ||
| 5 | + | ||
| 6 | + /// Work phone. | ||
| 7 | + work(1), | ||
| 8 | + | ||
| 9 | + /// Home phone. | ||
| 10 | + home(2), | ||
| 11 | + | ||
| 12 | + /// Fax machine. | ||
| 13 | + fax(3), | ||
| 14 | + | ||
| 15 | + /// Mobile phone. | ||
| 16 | + mobile(4); | ||
| 17 | + | ||
| 18 | + const PhoneType(this.rawValue); | ||
| 19 | + | ||
| 20 | + factory PhoneType.fromRawValue(int value) { | ||
| 21 | + switch (value) { | ||
| 22 | + case 1: | ||
| 23 | + return PhoneType.work; | ||
| 24 | + case 2: | ||
| 25 | + return PhoneType.home; | ||
| 26 | + case 3: | ||
| 27 | + return PhoneType.fax; | ||
| 28 | + case 4: | ||
| 29 | + return PhoneType.mobile; | ||
| 30 | + case 0: | ||
| 31 | + default: | ||
| 32 | + return PhoneType.unknown; | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /// The raw phone type value. | ||
| 37 | + final int rawValue; | ||
| 38 | +} |
lib/src/enums/ratio.dart
deleted
100644 → 0
| 1 | -/// The state of torch. | 1 | +/// The state of the flashlight. |
| 2 | enum TorchState { | 2 | enum TorchState { |
| 3 | - /// Torch is off. | ||
| 4 | - off, | 3 | + /// The flashlight is off. |
| 4 | + off(0), | ||
| 5 | 5 | ||
| 6 | - /// Torch is on. | ||
| 7 | - on, | 6 | + /// The flashlight is on. |
| 7 | + on(1); | ||
| 8 | + | ||
| 9 | + const TorchState(this.rawValue); | ||
| 10 | + | ||
| 11 | + /// The raw value for the torch state. | ||
| 12 | + final int rawValue; | ||
| 8 | } | 13 | } |
| @@ -2,6 +2,12 @@ import 'dart:typed_data'; | @@ -2,6 +2,12 @@ import 'dart:typed_data'; | ||
| 2 | import 'dart:ui'; | 2 | import 'dart:ui'; |
| 3 | 3 | ||
| 4 | import 'package:mobile_scanner/src/barcode_utility.dart'; | 4 | import 'package:mobile_scanner/src/barcode_utility.dart'; |
| 5 | +import 'package:mobile_scanner/src/enums/address_type.dart'; | ||
| 6 | +import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 7 | +import 'package:mobile_scanner/src/enums/barcode_type.dart'; | ||
| 8 | +import 'package:mobile_scanner/src/enums/email_type.dart'; | ||
| 9 | +import 'package:mobile_scanner/src/enums/encryption_type.dart'; | ||
| 10 | +import 'package:mobile_scanner/src/enums/phone_type.dart'; | ||
| 5 | 11 | ||
| 6 | /// Represents a single recognized barcode and its value. | 12 | /// Represents a single recognized barcode and its value. |
| 7 | class Barcode { | 13 | class Barcode { |
| @@ -500,272 +506,3 @@ class WiFi { | @@ -500,272 +506,3 @@ class WiFi { | ||
| 500 | ssid = data['ssid'] as String?, | 506 | ssid = data['ssid'] as String?, |
| 501 | password = data['password'] as String?; | 507 | password = data['password'] as String?; |
| 502 | } | 508 | } |
| 503 | - | ||
| 504 | -enum BarcodeFormat { | ||
| 505 | - /// Barcode format unknown to the current SDK. | ||
| 506 | - /// | ||
| 507 | - /// Constant Value: -1 | ||
| 508 | - unknown, | ||
| 509 | - | ||
| 510 | - /// Barcode format constant representing the union of all supported formats. | ||
| 511 | - /// | ||
| 512 | - /// Constant Value: 0 | ||
| 513 | - all, | ||
| 514 | - | ||
| 515 | - /// Barcode format constant for Code 128. | ||
| 516 | - /// | ||
| 517 | - /// Constant Value: 1 | ||
| 518 | - code128, | ||
| 519 | - | ||
| 520 | - /// Barcode format constant for Code 39. | ||
| 521 | - /// | ||
| 522 | - /// Constant Value: 2 | ||
| 523 | - code39, | ||
| 524 | - | ||
| 525 | - /// Barcode format constant for Code 93. | ||
| 526 | - /// | ||
| 527 | - /// Constant Value: 4 | ||
| 528 | - code93, | ||
| 529 | - | ||
| 530 | - /// Barcode format constant for Codabar. | ||
| 531 | - /// | ||
| 532 | - /// Constant Value: 8 | ||
| 533 | - codebar, | ||
| 534 | - | ||
| 535 | - /// Barcode format constant for Data Matrix. | ||
| 536 | - /// | ||
| 537 | - /// Constant Value: 16 | ||
| 538 | - dataMatrix, | ||
| 539 | - | ||
| 540 | - /// Barcode format constant for EAN-13. | ||
| 541 | - /// | ||
| 542 | - /// Constant Value: 32 | ||
| 543 | - ean13, | ||
| 544 | - | ||
| 545 | - /// Barcode format constant for EAN-8. | ||
| 546 | - /// | ||
| 547 | - /// Constant Value: 64 | ||
| 548 | - ean8, | ||
| 549 | - | ||
| 550 | - /// Barcode format constant for ITF (Interleaved Two-of-Five). | ||
| 551 | - /// | ||
| 552 | - /// Constant Value: 128 | ||
| 553 | - itf, | ||
| 554 | - | ||
| 555 | - /// Barcode format constant for QR Code. | ||
| 556 | - /// | ||
| 557 | - /// Constant Value: 256 | ||
| 558 | - qrCode, | ||
| 559 | - | ||
| 560 | - /// Barcode format constant for UPC-A. | ||
| 561 | - /// | ||
| 562 | - /// Constant Value: 512 | ||
| 563 | - upcA, | ||
| 564 | - | ||
| 565 | - /// Barcode format constant for UPC-E. | ||
| 566 | - /// | ||
| 567 | - /// Constant Value: 1024 | ||
| 568 | - upcE, | ||
| 569 | - | ||
| 570 | - /// Barcode format constant for PDF-417. | ||
| 571 | - /// | ||
| 572 | - /// Constant Value: 2048 | ||
| 573 | - pdf417, | ||
| 574 | - | ||
| 575 | - /// Barcode format constant for AZTEC. | ||
| 576 | - /// | ||
| 577 | - /// Constant Value: 4096 | ||
| 578 | - aztec, | ||
| 579 | -} | ||
| 580 | - | ||
| 581 | -extension BarcodeValue on BarcodeFormat { | ||
| 582 | - int get rawValue { | ||
| 583 | - switch (this) { | ||
| 584 | - case BarcodeFormat.unknown: | ||
| 585 | - return -1; | ||
| 586 | - case BarcodeFormat.all: | ||
| 587 | - return 0; | ||
| 588 | - case BarcodeFormat.code128: | ||
| 589 | - return 1; | ||
| 590 | - case BarcodeFormat.code39: | ||
| 591 | - return 2; | ||
| 592 | - case BarcodeFormat.code93: | ||
| 593 | - return 4; | ||
| 594 | - case BarcodeFormat.codebar: | ||
| 595 | - return 8; | ||
| 596 | - case BarcodeFormat.dataMatrix: | ||
| 597 | - return 16; | ||
| 598 | - case BarcodeFormat.ean13: | ||
| 599 | - return 32; | ||
| 600 | - case BarcodeFormat.ean8: | ||
| 601 | - return 64; | ||
| 602 | - case BarcodeFormat.itf: | ||
| 603 | - return 128; | ||
| 604 | - case BarcodeFormat.qrCode: | ||
| 605 | - return 256; | ||
| 606 | - case BarcodeFormat.upcA: | ||
| 607 | - return 512; | ||
| 608 | - case BarcodeFormat.upcE: | ||
| 609 | - return 1024; | ||
| 610 | - case BarcodeFormat.pdf417: | ||
| 611 | - return 2048; | ||
| 612 | - case BarcodeFormat.aztec: | ||
| 613 | - return 4096; | ||
| 614 | - } | ||
| 615 | - } | ||
| 616 | -} | ||
| 617 | - | ||
| 618 | -/// Address type constants. | ||
| 619 | -enum AddressType { | ||
| 620 | - /// Unknown address type. | ||
| 621 | - /// | ||
| 622 | - /// Constant Value: 0 | ||
| 623 | - unknown, | ||
| 624 | - | ||
| 625 | - /// Work address. | ||
| 626 | - /// | ||
| 627 | - /// Constant Value: 1 | ||
| 628 | - work, | ||
| 629 | - | ||
| 630 | - /// Home address. | ||
| 631 | - /// | ||
| 632 | - /// Constant Value: 2 | ||
| 633 | - home, | ||
| 634 | -} | ||
| 635 | - | ||
| 636 | -/// Barcode value type constants | ||
| 637 | -enum BarcodeType { | ||
| 638 | - /// Barcode value type unknown, which indicates the current version of SDK cannot recognize the structure of the barcode. Developers can inspect the raw value instead. | ||
| 639 | - /// | ||
| 640 | - /// Constant Value: 0 | ||
| 641 | - unknown, | ||
| 642 | - | ||
| 643 | - /// Barcode value type constant for contact information. | ||
| 644 | - /// | ||
| 645 | - /// Constant Value: 1 | ||
| 646 | - contactInfo, | ||
| 647 | - | ||
| 648 | - /// Barcode value type constant for email message details. | ||
| 649 | - /// | ||
| 650 | - /// Constant Value: 2 | ||
| 651 | - email, | ||
| 652 | - | ||
| 653 | - /// Barcode value type constant for ISBNs. | ||
| 654 | - /// | ||
| 655 | - /// Constant Value: 3 | ||
| 656 | - isbn, | ||
| 657 | - | ||
| 658 | - /// Barcode value type constant for phone numbers. | ||
| 659 | - /// | ||
| 660 | - /// Constant Value: 4 | ||
| 661 | - phone, | ||
| 662 | - | ||
| 663 | - /// Barcode value type constant for product codes. | ||
| 664 | - /// | ||
| 665 | - /// Constant Value: 5 | ||
| 666 | - product, | ||
| 667 | - | ||
| 668 | - /// Barcode value type constant for SMS details. | ||
| 669 | - /// | ||
| 670 | - /// Constant Value: 6 | ||
| 671 | - sms, | ||
| 672 | - | ||
| 673 | - /// Barcode value type constant for plain text. | ||
| 674 | - /// | ||
| 675 | - ///Constant Value: 7 | ||
| 676 | - text, | ||
| 677 | - | ||
| 678 | - /// Barcode value type constant for URLs/bookmarks. | ||
| 679 | - /// | ||
| 680 | - /// Constant Value: 8 | ||
| 681 | - url, | ||
| 682 | - | ||
| 683 | - /// Barcode value type constant for WiFi access point details. | ||
| 684 | - /// | ||
| 685 | - /// Constant Value: 9 | ||
| 686 | - wifi, | ||
| 687 | - | ||
| 688 | - /// Barcode value type constant for geographic coordinates. | ||
| 689 | - /// | ||
| 690 | - /// Constant Value: 10 | ||
| 691 | - geo, | ||
| 692 | - | ||
| 693 | - /// Barcode value type constant for calendar events. | ||
| 694 | - /// | ||
| 695 | - /// Constant Value: 11 | ||
| 696 | - calendarEvent, | ||
| 697 | - | ||
| 698 | - /// Barcode value type constant for driver's license data. | ||
| 699 | - /// | ||
| 700 | - /// Constant Value: 12 | ||
| 701 | - driverLicense, | ||
| 702 | -} | ||
| 703 | - | ||
| 704 | -/// Email format type constants. | ||
| 705 | -enum EmailType { | ||
| 706 | - /// Unknown email type. | ||
| 707 | - /// | ||
| 708 | - /// Constant Value: 0 | ||
| 709 | - unknown, | ||
| 710 | - | ||
| 711 | - /// Work email. | ||
| 712 | - /// | ||
| 713 | - /// Constant Value: 1 | ||
| 714 | - work, | ||
| 715 | - | ||
| 716 | - /// Home email. | ||
| 717 | - /// | ||
| 718 | - /// Constant Value: 2 | ||
| 719 | - home, | ||
| 720 | -} | ||
| 721 | - | ||
| 722 | -/// Phone number format type constants. | ||
| 723 | -enum PhoneType { | ||
| 724 | - /// Unknown phone type. | ||
| 725 | - /// | ||
| 726 | - /// Constant Value: 0 | ||
| 727 | - unknown, | ||
| 728 | - | ||
| 729 | - /// Work phone. | ||
| 730 | - /// | ||
| 731 | - /// Constant Value: 1 | ||
| 732 | - work, | ||
| 733 | - | ||
| 734 | - /// Home phone. | ||
| 735 | - /// | ||
| 736 | - /// Constant Value: 2 | ||
| 737 | - home, | ||
| 738 | - | ||
| 739 | - /// Fax machine. | ||
| 740 | - /// | ||
| 741 | - /// Constant Value: 3 | ||
| 742 | - fax, | ||
| 743 | - | ||
| 744 | - /// Mobile phone. | ||
| 745 | - /// | ||
| 746 | - /// Constant Value: 4 | ||
| 747 | - mobile, | ||
| 748 | -} | ||
| 749 | - | ||
| 750 | -/// Wifi encryption type constants. | ||
| 751 | -enum EncryptionType { | ||
| 752 | - /// Unknown encryption type. | ||
| 753 | - /// | ||
| 754 | - /// Constant Value: 0 | ||
| 755 | - none, | ||
| 756 | - | ||
| 757 | - /// Not encrypted. | ||
| 758 | - /// | ||
| 759 | - /// Constant Value: 1 | ||
| 760 | - open, | ||
| 761 | - | ||
| 762 | - /// WPA level encryption. | ||
| 763 | - /// | ||
| 764 | - /// Constant Value: 2 | ||
| 765 | - wpa, | ||
| 766 | - | ||
| 767 | - /// WEP level encryption. | ||
| 768 | - /// | ||
| 769 | - /// Constant Value: 3 | ||
| 770 | - wep, | ||
| 771 | -} |
| @@ -3,6 +3,7 @@ import 'dart:html' as html; | @@ -3,6 +3,7 @@ import 'dart:html' as html; | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:js/js.dart'; | 4 | import 'package:js/js.dart'; |
| 5 | import 'package:js/js_util.dart'; | 5 | import 'package:js/js_util.dart'; |
| 6 | +import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 6 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; | 7 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; |
| 7 | import 'package:mobile_scanner/src/objects/barcode.dart'; | 8 | import 'package:mobile_scanner/src/objects/barcode.dart'; |
| 8 | import 'package:mobile_scanner/src/web/media.dart'; | 9 | import 'package:mobile_scanner/src/web/media.dart'; |
| @@ -6,6 +6,7 @@ import 'dart:html'; | @@ -6,6 +6,7 @@ import 'dart:html'; | ||
| 6 | import 'dart:typed_data'; | 6 | import 'dart:typed_data'; |
| 7 | 7 | ||
| 8 | import 'package:js/js.dart'; | 8 | import 'package:js/js.dart'; |
| 9 | +import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 9 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; | 10 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; |
| 10 | import 'package:mobile_scanner/src/objects/barcode.dart'; | 11 | import 'package:mobile_scanner/src/objects/barcode.dart'; |
| 11 | import 'package:mobile_scanner/src/web/base.dart'; | 12 | import 'package:mobile_scanner/src/web/base.dart'; |
| @@ -4,6 +4,7 @@ import 'dart:typed_data'; | @@ -4,6 +4,7 @@ import 'dart:typed_data'; | ||
| 4 | import 'dart:ui'; | 4 | import 'dart:ui'; |
| 5 | 5 | ||
| 6 | import 'package:js/js.dart'; | 6 | import 'package:js/js.dart'; |
| 7 | +import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 7 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; | 8 | import 'package:mobile_scanner/src/enums/camera_facing.dart'; |
| 8 | import 'package:mobile_scanner/src/objects/barcode.dart'; | 9 | import 'package:mobile_scanner/src/objects/barcode.dart'; |
| 9 | import 'package:mobile_scanner/src/web/base.dart'; | 10 | import 'package:mobile_scanner/src/web/base.dart'; |
-
Please register or login to post a comment