diff --git a/wallet/lib/pages/events/event_purchase_view.dart b/wallet/lib/pages/events/event_purchase_view.dart index c5f3edc8b7..a70c9bbdcd 100644 --- a/wallet/lib/pages/events/event_purchase_view.dart +++ b/wallet/lib/pages/events/event_purchase_view.dart @@ -39,12 +39,29 @@ class EventPassViewContent extends StatelessWidget { final Events events; - final MobileScannerController controller = MobileScannerController( + late Rect scanWindow; + + MobileScannerController cameraController = MobileScannerController( formats: const [BarcodeFormat.qrCode], + autoStart: true, + detectionSpeed: DetectionSpeed.noDuplicates, ); + void _foundBarcode(BarcodeCapture barcodeCapture) { + debugPrint('$barcodeCapture'); + final String code = barcodeCapture.barcodes.last.displayValue ?? ''; + debugPrint('Code: $code'); + // context.read().add(ScannerTextEvent(scannedText: code)); + } + @override Widget build(BuildContext context) { + scanWindow = Rect.fromCenter( + center: MediaQuery.sizeOf(context).center(Offset(0, -130.h)), + width: 100.r, + height: 100.r, + ); + return ColoredBox( color: AppColors.kBlack87, child: SafeArea( @@ -85,12 +102,12 @@ class EventPassViewContent extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 20.w), height: 200.h, child: MobileScanner( - controller: controller, onDetect: (_) { print(_); }, ), ), + ], ), Container( diff --git a/wallet/lib/pages/events/event_qr_code_screen.dart b/wallet/lib/pages/events/event_qr_code_screen.dart index 78381bfdd7..fda1326899 100644 --- a/wallet/lib/pages/events/event_qr_code_screen.dart +++ b/wallet/lib/pages/events/event_qr_code_screen.dart @@ -69,7 +69,7 @@ class _EventQrCodeScreenState extends State { key: renderObjectKey, child: QrImageView( padding: EdgeInsets.zero, - data: jsonEncode(widget.events), + data: jsonEncode(widget.events.toJson()), size: 200, dataModuleStyle: const QrDataModuleStyle(color: AppColors.kWhite), eyeStyle: const QrEyeStyle(eyeShape: QrEyeShape.square, color: AppColors.kWhite), diff --git a/wallet/lib/pages/events/events_owner_view.dart b/wallet/lib/pages/events/events_owner_view.dart index 337c9cd810..ead5c1fa8a 100644 --- a/wallet/lib/pages/events/events_owner_view.dart +++ b/wallet/lib/pages/events/events_owner_view.dart @@ -207,6 +207,7 @@ class EventPassViewContent extends StatelessWidget { // placeholder: (context, url) => Shimmer(color: AppColors.kLightGray, child: const SizedBox.expand()), ), ), + SizedBox(height: 10.h), GestureDetector( onTap: () { showDialog( @@ -218,7 +219,7 @@ class EventPassViewContent extends StatelessWidget { }, child: SvgPicture.asset( Assets.images.icons.qr, - height: 20.h, + height: 40.h, ), ), ],