diff --git a/Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart b/Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart index 178aeed8..34d11059 100644 --- a/Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart +++ b/Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; +import 'package:simple_barcode_scanner/simple_barcode_scanner.dart'; class LoyaltyCards extends StatefulWidget { final AppUser signedInUser; @@ -142,48 +143,49 @@ class _LoyaltyCardsState extends State { ), const SizedBox(width: 10), MIHButton( - onTap: () async { - String bcodeScanResults; - try { - bcodeScanResults = await FlutterBarcodeScanner.scanBarcode( - '#ff6666', - 'Cancel', - true, - ScanMode.BARCODE, - ); - } on PlatformException { - bcodeScanResults = "Platform not supported"; - } + onTap: + // () async { + // String bcodeScanResults; + // try { + // bcodeScanResults = await FlutterBarcodeScanner.scanBarcode( + // '#ff6666', + // 'Cancel', + // true, + // ScanMode.BARCODE, + // ); + // } on PlatformException { + // bcodeScanResults = "Platform not supported"; + // } - if (!mounted) return; - setState(() { - cardNumberController.text = bcodeScanResults; - }); + // if (!mounted) return; + // setState(() { + // cardNumberController.text = bcodeScanResults; + // }); + // }, + // () { + // openscanner(); + // }, + () async { + print("here"); + String? res = await SimpleBarcodeScanner.scanBarcode( + context, + barcodeAppBar: const BarcodeAppBar( + appBarTitle: 'Scan Bardcode', + centerTitle: true, + enableBackButton: true, + backButtonIcon: Icon(Icons.arrow_back), + ), + isShowFlashIcon: true, + delayMillis: 500, + cameraFace: CameraFace.back, + scanFormat: ScanFormat.ONLY_BARCODE, + ); + if (res != null) { + setState(() { + cardNumberController.text = res; + }); + } }, - // () { - // openscanner(); - // }, - // () async { - // print("here"); - // String? res = await SimpleBarcodeScanner.scanBarcode( - // context, - // barcodeAppBar: const BarcodeAppBar( - // appBarTitle: 'Scan Bardcode', - // centerTitle: true, - // enableBackButton: true, - // backButtonIcon: Icon(Icons.arrow_back), - // ), - // isShowFlashIcon: true, - // delayMillis: 500, - // cameraFace: CameraFace.back, - // scanFormat: ScanFormat.ONLY_BARCODE, - // ); - // if (res != null) { - // setState(() { - // cardNumberController.text = res; - // }); - // } - // }, buttonText: "Scan", buttonColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), diff --git a/Frontend/pubspec.lock b/Frontend/pubspec.lock index 56339c8a..f1fa20a7 100644 --- a/Frontend/pubspec.lock +++ b/Frontend/pubspec.lock @@ -789,6 +789,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + permission_handler: + dependency: transitive + description: + name: permission_handler + sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb" + url: "https://pub.dev" + source: hosted + version: "11.3.1" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" + url: "https://pub.dev" + source: hosted + version: "12.0.13" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 + url: "https://pub.dev" + source: hosted + version: "9.4.5" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24" + url: "https://pub.dev" + source: hosted + version: "0.1.3+5" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 + url: "https://pub.dev" + source: hosted + version: "4.2.3" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.dev" + source: hosted + version: "0.2.1" petitparser: dependency: transitive description: @@ -941,6 +989,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + simple_barcode_scanner: + dependency: "direct main" + description: + name: simple_barcode_scanner + sha256: "993c4b0e22bbe6cf127f8e0001574fd54015b90e0698a058ec9fdb2fdf84bc55" + url: "https://pub.dev" + source: hosted + version: "0.2.5" simple_gesture_detector: dependency: transitive description: @@ -1306,6 +1362,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.16.3" + webview_windows: + dependency: transitive + description: + name: webview_windows + sha256: "47fcad5875a45db29dbb5c9e6709bf5c88dcc429049872701343f91ed7255730" + url: "https://pub.dev" + source: hosted + version: "0.4.0" win32: dependency: transitive description: @@ -1363,5 +1427,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.5.0 <3.7.0" + dart: ">=3.5.3 <3.7.0" flutter: ">=3.24.0" diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index 91a03b06..2d3ac2ad 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -60,7 +60,7 @@ dependencies: flutter_swipe_detector: ^2.0.0 youtube_player_iframe: ^5.2.0 syncfusion_flutter_barcodes: ^26.2.10 - # simple_barcode_scanner: ^0.2.5 + simple_barcode_scanner: ^0.2.5 mobile_scanner: ^6.0.2 flutter_launcher_icons: ^0.13.1 flutter_barcode_scanner: ^2.0.0 diff --git a/Frontend/windows/flutter/generated_plugin_registrant.cc b/Frontend/windows/flutter/generated_plugin_registrant.cc index b66d8da6..72aa3764 100644 --- a/Frontend/windows/flutter/generated_plugin_registrant.cc +++ b/Frontend/windows/flutter/generated_plugin_registrant.cc @@ -8,19 +8,25 @@ #include #include +#include #include #include #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); PrintingPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PrintingPlugin")); SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); + WebviewWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("WebviewWindowsPlugin")); } diff --git a/Frontend/windows/flutter/generated_plugins.cmake b/Frontend/windows/flutter/generated_plugins.cmake index 6b11b972..f358287e 100644 --- a/Frontend/windows/flutter/generated_plugins.cmake +++ b/Frontend/windows/flutter/generated_plugins.cmake @@ -5,9 +5,11 @@ list(APPEND FLUTTER_PLUGIN_LIST firebase_core geolocator_windows + permission_handler_windows printing syncfusion_pdfviewer_windows url_launcher_windows + webview_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST