mirror of
https://github.com/cupcakearmy/fight-of-the-mobiles.git
synced 2026-04-02 18:25:23 +00:00
finished flutter
This commit is contained in:
@@ -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",
|
||||
),
|
||||
|
||||
@@ -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');
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user