diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index ee157144..8d8aa21a 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}]} \ No newline at end of file +{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"qr_utils","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}]} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 9efee0c7..03e19fc5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,7 +3,8 @@ import 'package:InvenTree/widget/location_display.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; -// import 'package:preferences/preferences.dart'; + +import 'package:qr_utils/qr_utils.dart'; import 'settings.dart'; import 'api.dart'; @@ -113,6 +114,12 @@ class _MyHomePageState extends State { Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null))); } + void _scanCode() async { + QrUtils.scanQR.then((String result) { + print("Scanned: $result"); + }); + } + void _showStock() { Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null))); } @@ -151,6 +158,7 @@ class _MyHomePageState extends State { new Divider(), new ListTile( title: new Text("Scan"), + onTap: _scanCode, ), new ListTile( title: new Text("Parts"), diff --git a/pubspec.lock b/pubspec.lock index d6947e28..bb37a080 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -149,6 +149,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.1.0" + qr_utils: + dependency: "direct main" + description: + name: qr_utils + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" quiver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8ae45d63..2ec45e9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,6 +28,8 @@ dependencies: preferences: ^5.1.0 + qr_utils: ^0.1.4 + dev_dependencies: flutter_test: sdk: flutter