diff --git a/src/flutter/ios/Podfile.lock b/src/flutter/ios/Podfile.lock index 70fb3b3..fef6164 100644 --- a/src/flutter/ios/Podfile.lock +++ b/src/flutter/ios/Podfile.lock @@ -1,34 +1,65 @@ PODS: - - barcode_scan (0.0.1): - - Flutter - - MTBBarcodeScanner - Flutter (1.0.0) - flutter_local_notifications (0.0.1): - Flutter - - MTBBarcodeScanner (5.0.6) + - GoogleMobileVision/BarcodeDetector (1.3.2): + - GoogleMobileVision/Detector (~> 1.3) + - GoogleMobileVision/Detector (1.3.2): + - GoogleToolboxForMac/Logger (~> 2.1) + - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" + - GTMSessionFetcher/Core (~> 1.1) + - Protobuf (~> 3.1) + - GoogleToolboxForMac/Defines (2.1.4) + - GoogleToolboxForMac/Logger (2.1.4): + - GoogleToolboxForMac/Defines (= 2.1.4) + - "GoogleToolboxForMac/NSData+zlib (2.1.4)": + - GoogleToolboxForMac/Defines (= 2.1.4) + - GTMSessionFetcher/Core (1.1.15) + - native_device_orientation (0.0.1): + - Flutter + - Protobuf (3.6.0) + - qr_mobile_vision (0.0.1): + - Flutter + - GoogleMobileVision/BarcodeDetector + - qr_reader (0.0.1): + - Flutter DEPENDENCIES: - - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - Flutter (from `.symlinks/flutter/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) + - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) + - qr_mobile_vision (from `.symlinks/plugins/qr_mobile_vision/ios`) + - qr_reader (from `.symlinks/plugins/qr_reader/ios`) SPEC REPOS: https://github.com/cocoapods/specs.git: - - MTBBarcodeScanner + - GoogleMobileVision + - GoogleToolboxForMac + - GTMSessionFetcher + - Protobuf EXTERNAL SOURCES: - barcode_scan: - :path: ".symlinks/plugins/barcode_scan/ios" Flutter: :path: ".symlinks/flutter/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" + native_device_orientation: + :path: ".symlinks/plugins/native_device_orientation/ios" + qr_mobile_vision: + :path: ".symlinks/plugins/qr_mobile_vision/ios" + qr_reader: + :path: ".symlinks/plugins/qr_reader/ios" SPEC CHECKSUMS: - barcode_scan: 8288e70cb430072003bce2c794a1431e7adbcb4d Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 flutter_local_notifications: 696a74904e0a0ab754e27a5f761da4a7f9153710 - MTBBarcodeScanner: bb0bb62e18b57f8a571a482248adc20722b70a91 + GoogleMobileVision: 6b0a3a2dae1974ec35d80fdeeacc3a03193642e0 + GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f + GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2 + native_device_orientation: 1126735962ee926c7067a26ee9b0be020d3f5890 + Protobuf: 0fc0ad8bec688b2a3017a139953e01374fedbd5f + qr_mobile_vision: 245b97161167cbe4865327b9cc4741f7f0897878 + qr_reader: e49a76f945bd53335eb4caf6c4c719c26dd80986 PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2 diff --git a/src/flutter/lib/Screens/Home.dart b/src/flutter/lib/Screens/Home.dart index 38bf326..feec782 100644 --- a/src/flutter/lib/Screens/Home.dart +++ b/src/flutter/lib/Screens/Home.dart @@ -16,8 +16,8 @@ class Home extends StatelessWidget { Padding(padding: EdgeInsets.only(bottom: 80.0), child: Logo()), Button( callback: () { - // Navigator.pushNamed(context, '/scan'); - Navigator.pushNamed(context, '/success/1'); + Navigator.pushNamed(context, '/scan'); + // Navigator.pushNamed(context, '/success/1'); }, text: "Scan", ), diff --git a/src/flutter/lib/Screens/Scan.dart b/src/flutter/lib/Screens/Scan.dart index 3a7abcd..b451a08 100644 --- a/src/flutter/lib/Screens/Scan.dart +++ b/src/flutter/lib/Screens/Scan.dart @@ -1,27 +1,28 @@ -import 'dart:async'; +// import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +import 'package:qr_mobile_vision/qr_camera.dart'; +// import 'package:flutter/services.dart'; -import 'package:barcode_scan/barcode_scan.dart'; +// import 'package:barcode_scan/barcode_scan.dart'; import '../Components/BG.dart'; import '../Components/SyncIcon.dart'; class Scan extends StatelessWidget { - Future scan() async { - try { - String barcode = await BarcodeScanner.scan(); - print('Success'); - print(barcode); - Navigator.pushNamed(null, '/home'); - } on PlatformException catch (e) { - if (e.code == BarcodeScanner.CameraAccessDenied) - print('The user did not grant the camera permission!'); - } catch (e) { - print('Nope'); - print(e); - } - } + // Future scan() async { + // try { + // String barcode = await BarcodeScanner.scan(); + // print('Success'); + // print(barcode); + // Navigator.pushNamed(null, '/home'); + // } on PlatformException catch (e) { + // if (e.code == BarcodeScanner.CameraAccessDenied) + // print('The user did not grant the camera permission!'); + // } catch (e) { + // print('Nope'); + // print(e); + // } + // } @override Widget build(BuildContext context) => BG( @@ -33,7 +34,16 @@ class Scan extends StatelessWidget { 'Scanning...', style: TextStyle(fontWeight: FontWeight.bold), ), - SyncIcon() + SyncIcon(), + SizedBox( + width: 280.0, + height: 280.0, + child: new QrCamera( + qrCodeCallback: (code) { + Navigator.pushNamed(context, '/success/$code'); + }, + ), + ) ], ))); } diff --git a/src/flutter/lib/Screens/Success.dart b/src/flutter/lib/Screens/Success.dart index 7196dc8..322d461 100644 --- a/src/flutter/lib/Screens/Success.dart +++ b/src/flutter/lib/Screens/Success.dart @@ -10,8 +10,9 @@ class Success extends StatelessWidget { Success({@required this.result}) { final initializationSettings = InitializationSettings( AndroidInitializationSettings('app_icon'), IOSInitializationSettings()); - final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin() - ..initialize(initializationSettings); + + final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + flutterLocalNotificationsPlugin.initialize(initializationSettings); flutterLocalNotificationsPlugin.show( this.result, diff --git a/src/flutter/lib/main_new.dart b/src/flutter/lib/main_new.dart new file mode 100644 index 0000000..dcdced3 --- /dev/null +++ b/src/flutter/lib/main_new.dart @@ -0,0 +1,46 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:qr_reader/qr_reader.dart'; + +void main() { + runApp(MaterialApp( + home: MyHomePage(), + )); +} + +class MyHomePage extends StatefulWidget { + @override + createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + Future _barcodeString; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: FutureBuilder( + future: _barcodeString, + builder: (BuildContext context, AsyncSnapshot snapshot) { + return Text(snapshot.data != null ? snapshot.data : ''); + })), + floatingActionButton: FloatingActionButton( + onPressed: () { + setState(() { + _barcodeString = QRCodeReader() + .setAutoFocusIntervalInMs(200) + .setForceAutoFocus(true) + .setTorchEnabled(false) + .setHandlePermissions(true) + .setExecuteAfterPermissionGranted(true) + .scan(); + }); + }, + tooltip: 'Reader the QRCode', + child: Icon(Icons.add_a_photo), + ), + ); + } +} diff --git a/src/flutter/pubspec.lock b/src/flutter/pubspec.lock index 230bec1..1f4d38d 100644 --- a/src/flutter/pubspec.lock +++ b/src/flutter/pubspec.lock @@ -22,13 +22,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - barcode_scan: - dependency: "direct main" - description: - name: barcode_scan - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.6" boolean_selector: dependency: transitive description: @@ -200,6 +193,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + native_device_orientation: + dependency: transitive + description: + name: native_device_orientation + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.2" node_preamble: dependency: transitive description: @@ -256,6 +256,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.4.2" + qr_mobile_vision: + dependency: "direct main" + description: + name: qr_mobile_vision + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.7" + qr_reader: + dependency: "direct main" + description: + name: qr_reader + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" quiver: dependency: transitive description: diff --git a/src/flutter/pubspec.yaml b/src/flutter/pubspec.yaml index 2648e4d..b40d7e5 100644 --- a/src/flutter/pubspec.yaml +++ b/src/flutter/pubspec.yaml @@ -15,7 +15,9 @@ environment: dependencies: flutter: sdk: flutter - barcode_scan: ^0.0.6 + # barcode_scan: ^0.0.6 + qr_mobile_vision: any + qr_reader: ^0.1.3 flutter_local_notifications: any # The following adds the Cupertino Icons font to your application.