finished flutter

This commit is contained in:
nicco 2018-08-30 16:55:23 +02:00
parent ca7814bed9
commit 2906e18507
7 changed files with 144 additions and 40 deletions

View File

@ -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

View File

@ -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",
),

View File

@ -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');
},
),
)
],
)));
}

View File

@ -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,

View File

@ -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<MyHomePage> {
Future<String> _barcodeString;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: FutureBuilder<String>(
future: _barcodeString,
builder: (BuildContext context, AsyncSnapshot<String> 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),
),
);
}
}

View File

@ -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:

View File

@ -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.