Skip to content

Commit

Permalink
fix: qr view is not scannable
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 28, 2024
1 parent 78c372a commit 5c1f994
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
21 changes: 19 additions & 2 deletions wallet/lib/pages/events/event_purchase_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<QRScannerBloc>().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(
Expand Down Expand Up @@ -85,12 +102,12 @@ class EventPassViewContent extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 20.w),
height: 200.h,
child: MobileScanner(
controller: controller,
onDetect: (_) {
print(_);
},
),
),

],
),
Container(
Expand Down
2 changes: 1 addition & 1 deletion wallet/lib/pages/events/event_qr_code_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _EventQrCodeScreenState extends State<EventQrCodeScreen> {
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),
Expand Down
3 changes: 2 additions & 1 deletion wallet/lib/pages/events/events_owner_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -218,7 +219,7 @@ class EventPassViewContent extends StatelessWidget {
},
child: SvgPicture.asset(
Assets.images.icons.qr,
height: 20.h,
height: 40.h,
),
),
],
Expand Down

0 comments on commit 5c1f994

Please sign in to comment.